Page 1 of 1

Is there an script to check log files?

Posted: Sun May 19, 2013 10:58 am
by ruffsense
I'm searching for script that can tail and the check the log for certain words(like a filter).

I saw alot of check log files script but they will check the whole log. I only need to check the last entry in the log file.
This needs to be for a linux machine and also need to work with nrpe for remote check.

Re: Is there an script to check log files?

Posted: Mon May 20, 2013 3:40 am
by gshergill
Hi ruffsense,

This plugin is good:
It stores the location of the last search, so continues on from there (i.e. won't keep searching the whole log file).

Good luck!

Kind Regards,

Gary Shergill

Re: Is there an script to check log files?

Posted: Mon May 20, 2013 11:00 am
by scottwilkerson
One this to note with this plugin, if you test it as root from the command line before deploying to nagios, make sure the nagios user has permissions to read/write the seek file.

Re: Is there an script to check log files?

Posted: Tue May 21, 2013 1:56 am
by ruffsense
Not working for me...

Plug-in error: time out after 15 seconds

Re: Is there an script to check log files?

Posted: Tue May 21, 2013 10:15 am
by slansing
Can you show us the format of the command you were running, as if running it from the command line? Were you running the plugin locally, or to a remote system?..

Re: Is there an script to check log files?

Posted: Thu May 23, 2013 1:26 am
by ruffsense
slansing wrote:Can you show us the format of the command you were running, as if running it from the command line? Were you running the plugin locally, or to a remote system?..

check_log3.pl -l /var/log/audit.log -s /tmp/audit.seek -p 'errors' -w 0 -c 1

Re: Is there an script to check log files?

Posted: Thu May 23, 2013 12:16 pm
by abrist
How big is the log?

Re: Is there an script to check log files?

Posted: Fri May 24, 2013 4:55 am
by ruffsense
abrist wrote:How big is the log?
46870862387 May 24 11:50 rtfenqueue.log

It is really big.

Re: Is there an script to check log files?

Posted: Fri May 24, 2013 10:35 am
by abrist
You should run the script locally from the remote host's cli. Time it. You will need to make sure the timeout on the check is a bit longer than the average length of time it takes for the script to run. Or run the script passively and then report the result back to the Nagios server.