linux - syslog-ng perl pipe dropping events -
i'm trying pipe syslogs perl script via syslog-ng not of syslog entries make through - maybe 1 in 3 happen.
i've looked on place , can't find remotely having problem have. seems simple can't find answer!
here's syslog-ng setup:
source s_1 { tcp(port(514)); }; destination d_zen { program("/tmp/zen.pl"); }; log { source(s_1); destination(d_zen); }; and here's perl script:
#!/usr/bin/perl use strict; use warnings; $|=1 $filename = "/tmp/zen.log"; open(my $fh, '>>', $filename) or die "could not open file '$filename' $!"; while ( <stdin> ) { print $fh <stdin>."\n"; }; any thoughts?
is perl line buffer disabled?
according syslog-ng manual, can cause problems:
"certain external applications buffer log messages, might cause unexpected latency , other problems. example, if send log messages external perl script, perl uses line buffer terminal output , block buffer otherwise. might want disable buffering in external application."
also, don't know how script reads incoming messages (i don't perl), think should use loop keep reading incoming messages. syslog-ng should start script once @ startup, , should keep running , processing messages.
hth,
regards, robert fekete
Comments
Post a Comment