http://qs321.pair.com?node_id=506244

chanakya has asked for the wisdom of the Perl Monks concerning the following question:

Greetings everyone !!!

I'm working on a monitoring project, which includes monitoring of our components. This includes that we check the cron output (/var/log/cron) file for each particular component.

For example: "Syncmail" is a component which needs to be monitored, for this the cron log has to be parsed to get the last run (the last time,datetime it executed) of "Syncmail" and the time it ran.

Below is the format of the cron log
Oct 15 23:00:00 msg CROND[533]: (root) CMD (/usr/local/ascripts/sende +mail.pl -i Ticket -s db -uad > /home/message/ticket.debug) Oct 15 23:00:00 msg CROND[536]: (message) CMD (/usr/local/ascripts/sen +demail.pl -i Ticket -s db -uad > /home/message/ticket.debug) Oct 15 24:10:53 msg CROND[538]: (message) CMD (/home/message/Syncmail. +pl -i Ticket -s db -uad > /home/message/ticket.debug)
At present I'm not sure how to go about this. Please put forwad your valuable suggestions and sample code for the same
Thank you for your time

Replies are listed 'Best First'.
Re: Parsing a cron log to get the last run/datetime of a script
by stonecolddevin (Parson) on Nov 07, 2005 at 07:02 UTC
    Have you searched http://sourceforge.net for something like this? i'm sure there's an abundance of cron log parsers out there...
    meh.