Perl script to monitor application start and stop events in logfile

10 pts.
Tags:
Perl
Unix
Hello, I am looking for a perl script for Unix that would monitor for a start and stop line in an applciaiton logfile that contains the date/time of stat and stop. It needs to be able to calculate the date/time from start of applciation for 30 minutes and if no stop is logged to logfile within 30 minutes to send an alert or email notification. Not a perl scriptor, but Perl is needed for my environment. Any help appreciated. Thanks.

Answer Wiki

Thanks. We'll let you know when a new response is added.

I would recommend <a href=”http://simple-evcorr.sourceforge.net/”>SEC</a>. You can use SEC to monitor the logfile in real time and have it keep track of what you want it to. You would want a <b>PairWithWindow</b> type rule. Something like this:
<pre>
type=PairWithWindow
ptype=RegExp
pattern=MyApplication started
desc=MyApplication started
action=logonly; pipe ‘$0′ /bin/mailx -s ‘MyApplication hasn’t stopped in 30 minutes’ somebody@mydom.com
ptype2=RegExp
pattern2=MyApplication stopped
desc2=MyApplication stopped
action2=none
window=18001
</pre>

That rule will send you an email if the app stop isn’t noticed 30 mins after the app start. You would launch sec.pl with the <pre>-input=/path/to/logfile </pre>option for it to follow a certain log.

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following