Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Writing external output plugins
for RSysLog
IN 2 MINUTES
Rainer Gerhards
Write the plugin itself
• Choose any language you like
• Implement the pseudocode below
▫
▫
▫
▫

Messages arrive via stdin...
Make RsysLog call plugin
• Regular filtering applies (as with any action)
• You can specify message format via a template
...
Optional: debugging your plugin
• If something doesn't work, it's best to debug outside
of rsyslog
• Do this as you usuall...
Want to know more details?
• There is an additional presentation available at
http://www.slideshare.net/rainergerhards1/ex...
Want to know more details?
• There is an additional presentation available at
http://www.slideshare.net/rainergerhards1/ex...
Upcoming SlideShare
Loading in …5
×

Writing rsyslog Plugins in 2 Minutes

12,688 views

Published on

Need to connect rsyslog to some destination for which no plugin yet exists? Do you know a little bit of scripting or programming? Than this presentation is for you. It's fast-path to writing rsyslog plugins very, very quickly.

Published in: Technology, Art & Photos
  • Be the first to comment

Writing rsyslog Plugins in 2 Minutes

  1. 1. Writing external output plugins for RSysLog IN 2 MINUTES Rainer Gerhards
  2. 2. Write the plugin itself • Choose any language you like • Implement the pseudocode below ▫ ▫ ▫ ▫ Messages arrive via stdin, one message per line Read from stdin until EOF Process each message read as you like Terminate when EOF is reached • That's it! While not EOF(stdin) do {     Read msg from stdin     Process msg } Rainer Gerhards, http://blog.gerhards.net
  3. 3. Make RsysLog call plugin • Regular filtering applies (as with any action) • You can specify message format via a template • Use omprog for the call module(load=”omprog) # needed only once in config! if $rawmsg contains “sometrigger” then    action(type=”omprog”           binary=”/path/to/your/plugin”) Rainer Gerhards, http://blog.gerhards.net
  4. 4. Optional: debugging your plugin • If something doesn't work, it's best to debug outside of rsyslog • Do this as you usually debug your programs in that language • For example, do $ echo “testmessage” | /path/to/your/plugin • Questions about the plugin interface or plugin integration? Visit http://kb.monitorware.com/external-plugins-f53.html Rainer Gerhards, http://blog.gerhards.net
  5. 5. Want to know more details? • There is an additional presentation available at http://www.slideshare.net/rainergerhards1/external-plugins • The complete interface specification can be found right inside the source repository: https://github.com/rsyslog/rsyslog/blob/master/plugins/external/INTERFACE.md • Check out the copy-templates ▫ Available for an increasing number of languages ▫ More advanced interface handling ▫ Ready to be copied ▫ https://github.com/rsyslog/rsyslog/tree/master/plugins/external Rainer Gerhards, http://blog.gerhards.net
  6. 6. Want to know more details? • There is an additional presentation available at http://www.slideshare.net/rainergerhards1/external-plugins • The complete interface specification can be found right inside the source repository: https://github.com/rsyslog/rsyslog/blob/master/plugins/external/INTERFACE.md • Check out the copy-templates ▫ Available for an increasing number of languages ▫ More advanced interface handling ▫ Ready to be copied ▫ https://github.com/rsyslog/rsyslog/tree/master/plugins/external Rainer Gerhards, http://blog.gerhards.net

×