Maybe perl has some module to handle this but I use "Blat" for NT and "MAIL" for Unix. These 2 subs should help. You need to open your logfile and check for an error string. If you catch it you will get an e-mail.
sub Notify { local $Message = $_[0]; &MailMessage(${MailList},"***${JobName}: ${Host}: ${Message} ${LogFil +e}",${LogFile},${Host} ); }; sub MailMessage { # This file will send mail to the recipient with the given subject. # If the body is supplied, it will also be sent. If a sender is # supplied, the message will be marked with that sender in the "From" # field. local $Recipient = $_[0]; local $Subject = $_[1]; local $Body = $_[2]; local $Sender = $_[3]; $Recipient =~ s/\n+//; $Subject =~ s/\n+//; $Sender =~ s/\n+//; if (!defined $MailFile) { if ($OSFlag ne "Y") { &DefineOS; }; $MailFile = "${Temp}/mis_mail.$$"; }; if (-r $Body) { open (MAILFILE, "> $MailFile"); open (BODY, "$Body"); while (<BODY>) { print MAILFILE "$_"; }; close (BODY); close (MAILFILE); } else { open (MAILFILE, "> $MailFile"); print MAILFILE "$Body"; close (MAILFILE); }; if ($OS eq "MSWin32") { $Mail = qq! $Mail $MailFile -t "$Recipient" -s "$Subject" ! . qq! -i "$Sender" -f "$Sender" !; print "using blat...\n"; open (MAIL, "| $Mail"); while (<MAIL>) { print $_; }; close (MAIL); print "closing blat...\n"; } else { open (MAILFILE, "$MailFile"); open (MAIL, "| $Mail $Recipient"); print MAIL "To: $Recipient\n"; print MAIL "From: $Sender\n"; print MAIL "Subject: $Subject\n"; while (<MAILFILE>) { print MAIL $_; }; print MAIL "\n.\n"; close (MAIL); close (MAILFILE); }; $mesg = "Mail sent to $Recipient\n"; LogMessage($mesg); unlink ("$MailFile"); };

In reply to Re: reading of log files by codechuck
in thread reading of log files by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.