On Thu, Apr 14, 2005 at 02:23:15PM -0700, Vaibhav Goel wrote:
Thanks Nate.
I am using (trying to) an alternate approach now...I am going to write a perl script that gets everything from STDIN and parses the log data, does some regexp matching and writes out the logs based on that....check this simple script (which does not wanna work):
#!/usr/bin/perl -w
my $input = <STDIN> ; if ($input =~ /xyz/) { $var = "xyz.log"; open(LOG, ">>/tmp/$var"); print LOG "$input"; close(LOG); }
This does not seem to want to work using syslog-ng (it works fine from the commandline though),...any ideas anyone?
http://www.campin.net/syslog-ng/faq.html#external_program Your perl script needs to keep reading STDIN continuously. The perl script referenced in the thread I linked to shows how easy perl makes this: http://www.campin.net/perl-mail.txt - STDIN is already contained in $_ when you do "#!/usr/bin/perl -n". -- Nate "Internet is so big, so powerful and pointless that for some people it is a complete substitute for life." - Brown, Andrew