I have a site that keeps going down at midnight, and i think it may be due to my server logs being rotated. how do i find out when that occurs each day? any help would be greatly appreciated.
So, regardless of Linux distribution or application, it's generally easy to see when log files are rotated by their nature. Check the timestamps on the first and last entries in each log file, and there you go.
You can see when a process was started. So you can see if your server was restarted at midnight:
ps -eo pid,stime,cmd
For the log files, first check that they are closed, then check the mtime and ctime with:
stat filename
For the old file it is interested the Modify time to know when it was closed. This should be close to the Change time of the new log file that is still open.
Scripts executed daily usually are in the
/etc/cron.daily/
directory. You can also check scripts in/etc/cron.d/
and the file/etc/crontab
.Log rotation rules are usually at
/etc/logrotate.d/
So, regardless of Linux distribution or application, it's generally easy to see when log files are rotated by their nature. Check the timestamps on the first and last entries in each log file, and there you go.
You can see when a process was started. So you can see if your server was restarted at midnight:
For the log files, first check that they are closed, then check the mtime and ctime with:
For the old file it is interested the Modify time to know when it was closed. This should be close to the Change time of the new log file that is still open.