in reply to Creating a Deamonized Log Scraper
#!/usr/bin/perl -w # use strict; use Parallel::ForkManager; use File::ReadBackwards; # my (@DBLOG,@SKIPCODES,$logline,$line,$list,$node,$pm,$i); # @DBLOG=qw( /bd01/systems/systems.lg /ad04/orders/orders.lg /bd02/maste +r/master.lg /cd01/billing/billing.lg /cd02/audit/audit.lg /bd01/custo +m/custom.lg /bd01/apprules/apprules.lg ); # @SKIPCODES=qw( lots of inconsequential stuff that I want to ignore ); $list = join ("|", map {quotemeta} @SKIPCODES); $node=`uname -n`; $pm=new Parallel::ForkManager(7); foreach ($i) { my $pid=$pm->start and next; while (1==1) { $line = File::ReadBackwards->new( $i ) || die "Can't read from + $i:$!"; $logline = $line->readline; next if $logline =~ /\W$list\W/; next if $logline =~ /^$/; system ("echo \"There is a problem with database logfile: \"$i +\" on $node\. Here is the error\:\n\n $logline\" | mailx -s \"PROGRE +SS DATABASE PROBLEM!!!\" psmith\@xxxxx\.com"); system ("sleep 120"); } }
|
|---|