convert date and time to epoch in awk

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


>> On Tue, 19 Feb 2013 23:34:21 +0100, 
>> b w <bw.mail.lists at gmail.com> 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:
     http://www.hcst.net/~vogelke/src/logfiles/

   Some relevant links for Nagios:
     http://serverfault.com/questions/172875/
     Is Nagios capable of covering the functionality of Logwatch?

     http://stackoverflow.com/questions/2373212/
     How do I use Nagios to monitor a log file

     http://serverfault.com/questions/44/
     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