Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: monitorlogs.pl

by BigJoe (Curate)
on Feb 08, 2002 at 17:12 UTC ( [id://144149]=note: print w/replies, xml ) Need Help??


in reply to monitorlogs.pl

to make it work with rotating logs add an elsif at the end and do this:
} elsif ($size < $length) { my $rolled_log = "$logfile.1"; if(-e $rolled_log){ open(LOG, $rolled_log) || die "couldn't open file"; seek (LOG, $length+1,0); my $data_to_send = ""; while(<LOG>){ $data_to_send .= $_; } close LOG; open LOG, $logfile || die "Couldn't open logfile"; seek (LOG, $length+1,0); while(<LOG>){ $data_to_send .= $_; } my $smtp=Net::SMTP->new($smtpserver,Timeout=>30); $smtp->mail($from); $smtp->to($to); $smtp->data(); $smtp->datasend("From: $from\n"); $smtp->datasend("Subject: $applicationname Error\n"); $smtp->datasend("\n$data_to_send"); $smtp->dataend(); $smtp->quit(); open FILE, ">$lengthfile" || die "Couldn't open lengthfile for w +riting"; print FILE $size; close FILE; }


--BigJoe

Learn patience, you must.
Young PerlMonk, craves Not these things.
Use the source Luke.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://144149]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2024-04-19 06:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found