Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Parsing a cron log to get the last run/datetime of a script

by chanakya (Friar)
on Nov 07, 2005 at 06:24 UTC ( #506244=perlquestion: print w/replies, xml ) Need Help??

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 -i Ticket -s db -uad > /home/message/ticket.debug) Oct 15 23:00:00 msg CROND[536]: (message) CMD (/usr/local/ascripts/sen -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 for something like this? i'm sure there's an abundance of cron log parsers out there...

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://506244]
Approved by jbrugger
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2022-12-08 02:16 GMT
Find Nodes?
    Voting Booth?

    No recent polls found