convert date and time to epoch in awk

Karl Vogel vogelke+unix at
Wed Feb 20 01:42:54 UTC 2013

>> On Tue, 19 Feb 2013 23:34:21 +0100, 
>> b w <bw.mail.lists at> said:

b> I want to write a script that parses the last, say, 10 minutes of a log
b> file looking for a certain string, like 'error', or failed', and returns
b> how many times it shows up. The script would be run by Nagios and if it
b> returns > 0 an alert is raised. Each line of the log file starts with a
b> date like 'Feb 19 23:45:32'.

   Instead of looking for 'error' or 'failed', I'd recommend weeding out
   benign log entries and returning everything else.  Some examples:

   Some relevant links for Nagios:
     Is Nagios capable of covering the functionality of Logwatch?
     How do I use Nagios to monitor a log file
     What tool do you use to monitor your servers?

Karl Vogel                      I don't speak for the USAF or my company

John, this smells worse than your uncle's codpiece (which I wish you would
stop wearing to work), and in reviewing it I can deduce that your parents
were never formally introduced.
                    --Slashdot suggestion for inspecting poorly-written code

More information about the freebsd-questions mailing list