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
log monitoring with rotation timestamp
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: log monitoring with rotation timestamp
What Nagios plugin are you using?
Re: log monitoring with rotation timestamp
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.
Then your Nagios configuration would just need to look at the error_log file and not need to know about timestamps.
Re: log monitoring with rotation timestamp
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
My apache is on windows. (sorry not linux)
Do you have any links to download logrotate for windows.?
Thanks and regards,
Eric
Re: log monitoring with rotation timestamp
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.
Re: log monitoring with rotation timestamp
Thank you very much