RE: [syslog-ng]Match macro in filename?
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? -----Original Message----- From: syslog-ng-admin@lists.balabit.hu [mailto:syslog-ng-admin@lists.balabit.hu] On Behalf Of Nate Campi Sent: April 14, 2005 2:12 PM To: syslog-ng@lists.balabit.hu Subject: Re: [syslog-ng]Match macro in filename? On Thu, Apr 14, 2005 at 07:55:24AM -0700, Vaibhav Goel wrote:
Cool that it is 1.9.4. Is 1.9.4 production ready by any chance? I am currently using 1.6.5. If not, is there any other way you can suggest to solve this "problem"? I am not averse to writing some scripts
etc.. Good news on the feature in the 1.9 branch! As for using 1.6.5, someone else just brought this up the other day, see this thread: https://lists.balabit.hu/pipermail/syslog-ng/2005-April/007260.html -- Nate "If you put a billion monkeys in front of a billion typewriters typing at random, they would reproduce the entire collected works of Usenet in about ... five minutes." -Anon. "Come to think of it, there are already a million monkeys on a million typewriters, and the Usenet is NOTHING like Shakespeare!" -Blair Houghton _______________________________________________ syslog-ng maillist - syslog-ng@lists.balabit.hu https://lists.balabit.hu/mailman/listinfo/syslog-ng Frequently asked questions at http://www.campin.net/syslog-ng/faq.html
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
participants (2)
-
Nate Campi
-
Vaibhav Goel