I'm thinking this is some kind of buffer issue and wondering if anything can be done about it:
The script included below is really simple so I hope its not some script error causing this. How script is used: System logger is setup to write everything but mail and news logs to a named pipe: On linux that is accomplished in syslog.conf or in my case rsyslog.conf like this: grep '|' /etc/rsyslog.conf *.*;mail.none;news.none |/var/adm/pipe Then the filter script just reads from that (named)pipe. ./sysfltr pipe It works fine, and as you'll see below the script to both stdout in teh form of console and to a log file. Again... appears to work. However the log file takes quite a long time to starting showing any action, and then stay well behind the console output. Here is what `wc' sees right now: wc (lines in console saved to file) tocnt 84 922 6741 tocnt wc /var/adm/log/pipe1.log (written from filter script) 51 562 4096 /var/adm/log/pipe1.log That be some kind of buffer filling up, but I wondered if we have a way to flush the buffer from the perlscript to make the file closer to live output. ------- --------- ---=--- --------- -------- cat sysfltr #!/usr/local/bin/perl use strict; use warnings; my $ucsb = qr/ucsb/; my $temp_thresh =qr/Temperature above Threshold/; my $hddtemp = qr/hddtemp/; my $logdir ='/var/adm/log'; my $logname = 'pipe1.log'; open(LOGNAME,"> $logdir/$logname")or die "Can't open $logdir/$logname: $!"; while(<>){ if (/$ucsb|$temp_thresh|$hddtemp/){ print LOGNAME $_; print $_; } } -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/