I find the easiest way to do it is with Parse::Syslog and File::Tail...
#!/usr/bin/perl -w use strict; use warnings; use File::Tail; use Parse::Syslog; my $log = File::Tail->new("/var/log/syslog"); my $parser = Parse::Syslog->new($log); while(my $sl = $parser->next) { print qq[ program $sl->{program} with pid $sl->{pid} on host $sl->{host} said $sl->{text} at $sl->{timestamp} ]; }
| We're not surrounded, we're in a target-rich environment! |
|---|
In reply to Re: Best method to monitor active syslog files?
by jasonk
in thread Best method to monitor active syslog files?
by neilwatson
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |