Is there an script to check log files?

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
User avatar
ruffsense
Posts: 140
Joined: Thu Apr 11, 2013 12:40 am

Is there an script to check log files?

Post 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.
User avatar
gshergill
Posts: 231
Joined: Tue Aug 07, 2012 5:08 am

Re: Is there an script to check log files?

Post 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
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Is there an script to check log files?

Post 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.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
User avatar
ruffsense
Posts: 140
Joined: Thu Apr 11, 2013 12:40 am

Re: Is there an script to check log files?

Post by ruffsense »

Not working for me...

Plug-in error: time out after 15 seconds
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Is there an script to check log files?

Post 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?..
User avatar
ruffsense
Posts: 140
Joined: Thu Apr 11, 2013 12:40 am

Re: Is there an script to check log files?

Post 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
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Is there an script to check log files?

Post by abrist »

How big is the log?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
User avatar
ruffsense
Posts: 140
Joined: Thu Apr 11, 2013 12:40 am

Re: Is there an script to check log files?

Post by ruffsense »

abrist wrote:How big is the log?
46870862387 May 24 11:50 rtfenqueue.log

It is really big.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Is there an script to check log files?

Post 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.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Locked