log monitoring with rotation timestamp

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
erictse2
Posts: 3
Joined: Thu May 29, 2014 10:38 am

log monitoring with rotation timestamp

Post by erictse2 »

Hi,

I am using apache and configured logs with timestamp.
I am facing potential problem in adding these files Nagios file monitor
I don't know which is effective way I can use to add log files. same time it should not read old files.

error_log.1388707200 (this is unix system time stamp)

This file is not error_log that I can directly feed in the monitor.

Because it has timestamp error_log.{timestamp}
And the time stamp is changing everyday.

I am not sure if someone can point me out the directions how I can configure Nagios to point to the file with latest timestamp?

Thanks and regards,
Eric
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: log monitoring with rotation timestamp

Post by scottwilkerson »

What Nagios plugin are you using?
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
User avatar
eloyd
Cool Title Here
Posts: 2129
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: log monitoring with rotation timestamp

Post by eloyd »

One option would be to use logrotate instead of Apache's log format with timestamp. Then you would always have error_log as the current file. logrotate runs out of cron and will rotate old log files and kill -HUP apache to have it restart logging. This is pretty straightforward and there are many resources that show you how to do it.

Then your Nagios configuration would just need to look at the error_log file and not need to know about timestamps.
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoydI'm a Nagios Fanatic!
erictse2
Posts: 3
Joined: Thu May 29, 2014 10:38 am

Re: log monitoring with rotation timestamp

Post by erictse2 »

Thank you very much for pointing the direction.

My apache is on windows. (sorry not linux)
Do you have any links to download logrotate for windows.?

Thanks and regards,
Eric
User avatar
eloyd
Cool Title Here
Posts: 2129
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: log monitoring with rotation timestamp

Post by eloyd »

A quick Google search for "logrotate for Windows" gave me this: http://sourceforge.net/projects/logrotatewin/. I have not looked at it or used it, but it looks like the same thing for Windows. You will need to use the Windows Task Scheduler to take the place of cron, but I am sure the documentation for logrotatewin will tell you how to do that.
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoydI'm a Nagios Fanatic!
erictse2
Posts: 3
Joined: Thu May 29, 2014 10:38 am

Re: log monitoring with rotation timestamp

Post by erictse2 »

Thank you very much :)
Locked