[prev in list] [next in list] [prev in thread] [next in thread] 

List:       syslog-ng
Subject:    Re: [syslog-ng]Match macro in filename?
From:       Nate Campi <nate () campin ! net>
Date:       2005-04-14 21:31:06
Message-ID: 20050414213106.GF26013 () campin ! net
[Download RAW message or body]

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

_______________________________________________
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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic