Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: monitorlogs.pl

by BigJoe (Curate)
on Feb 08, 2002 at 17:12 UTC ( #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.


Comment on Re: monitorlogs.pl
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2014-07-29 00:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (211 votes), past polls