Logging, Syslog and Log Anaylsys Forums
September 08, 2010, 08:56:47 am *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News:
   Home   WIKI BLOG Help Search Recent Topics GoogleTagged Login Register  
Pages: [1]
  Print  
Author Topic: Pipe an input file through a script  (Read 103 times)
mauleta
Newbie
*
Offline Offline

Posts: 1


View Profile
« on: July 21, 2010, 02:08:47 pm »

Is it possible to pipe an input file through another script for syslog-ng to forward?  I have a file that has multiple lines per record with a blank line as a record dlimiter.  It needs to be forwarded to our centralized syslog server as one line per record.  I already have a script to do it, just need to know what I need in syslog-ng.conf to accomplish it.

Thanks
Logged
Admin
Administrator
Newbie
*****
Offline Offline

Posts: 178


View Profile WWW
« Reply #1 on: July 21, 2010, 02:48:24 pm »

Probably the best way to do it is by creating a socket and setting syslog-ng to read from the socket, and the script to write to the socket.  On the road at the moment, but I can post how that would look in syslog-ng.conf later this evening.
Logged
Admin
Administrator
Newbie
*****
Offline Offline

Posts: 178


View Profile WWW
« Reply #2 on: July 22, 2010, 08:48:09 am »

Here is a sample that will do what you need using named pipes:
Code:
source s_pipe { pipe("/var/run/logpipe");};
destination d_messages { file("/var/log/pipelogs");};
log {source(s_pipe); destination(d_messages);};

Have your script direct it's output to /var/run/logpipe and they should show up in /var/log/pipelogs.  Once the logs are getting in to syslog-ng, you can filter them, send them to different destinations, etc.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC | Sitemap Valid XHTML 1.0! Valid CSS!