in reply to reading of log files

Sounds to me like you need logcheck. It's a shell script, usually set up by the admin as an hourly cron job, but also workable in your home space if you have permission to access the logs. it might save you some work.

Failing that, here's the bit that will read the file and record anything bad it finds:

my $logfile = '/full/path/to/logfile'; my $badnews; open (LF, "<$logfile") or die ("open $logfile failed: $!); flock (LF,1) or die ("flock $logfile failed: $!"); while (<LF>) { $badnews .= $_ if (m/bad news/i); # some work needed } close(LF) or die ("close $logfile failed: $!); if ($badnews) { # do something }

Which just leaves you to write the regex that will spot bad news in the file, and a sub to send you $badnews in an email message if it finds any.

You should also replace the or die() instructions with something that will send you another sort of message if reading the logfile fails.

Bear in mind that there are issues with constantly incremented files: when perl opens the file it will remember the length of it and read only that far unless you resest the EOF flag. It probably doesn't matter, but the cookbook has more information if you need it.

Hope this helps.