2

After I installed nginx, its logs have been rotating weekly as per a weekly cron job on Sunday 00:00

However this week the logs failed to rotate, and I can't figure out why.

The only thing I can think that would have affected it is I did an apt-get upgrade. This went smoothly, with only one config file needing manual merging.

I can't find any logs for logrotate itself. It seems like I would expect to see something in /var/syslog for the logrotate cron job, but there's nothing there (ever).

Second, logrotate seems to be properly configured for nginx. There is an nginx config file that looks good in logrotate.d

logrotate cron job is also still in /etc/cron.daily

Thanks for any help - looking for the reason that this could have worked before but suddenly stopped, or for where to look for any extra logging output from cron or logrotate itself.

2
+25

Invoking logrotate manually with the -v option might shed more light on what's going on, be warned that this might be a disruptive operation depending on what logs are rotated.

Apart from that, it's hard to say if there's nothing at all in the logs: Checking disk space/free inodes with df could help, inspecting dmesg might give an indication if the disk is failing.

2

you may test the specific file for errors by running in debug mode ;

/usr/sbin/logrotate -d /etc/logrotate.d/nginx

You may force logrotate to run via specific file as well

/usr/sbin/logrotate -f /etc/logrotate.d/nginx

In most of the cases -- lograte may fail due to write errors in the specified directory (may be the rotated file is already present ? or the relevant folder is missing ?)

If above are working fine you may need to run the debug mode using the common logrotate conf file (this will trigger the debug mode and help find out the issues other than nginx logrotate)

/usr/sbin/logrotate -d /etc/logrotate.conf

If above run successfully -- you will need to confirm if the crontabs are working correctly for the Linux user in question (root ?). You may setup a simple echo based cron to check the same.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.