We're running Nginx on a couple Ubuntu servers (16.04) and all in all everything is working fine. However after some time (few days) Nginx stops logging requests to the logs (/var/log/nginx/[host].log). If I restart Nginx logging resumes/starts back up. But pretty frustrating as I don't know exactly when logging stops and all in all, don't want to not be logging the traffic.
Thoughts on what could be causing this or how to fix?
Logrotate config:
/var/log/nginx/*.log {
daily
missingok
rotate 14
compress
delaycompress
notifempty
create 0640 www-data adm
sharedscripts
prerotate
if [ -d /etc/logrotate.d/httpd-prerotate ]; then \
run-parts /etc/logrotate.d/httpd-prerotate; \
fi \
endscript
postrotate
invoke-rc.d nginx rotate >/dev/null 2>&1
endscript
}
I ran across this question just the other day:
https://unix.stackexchange.com/questions/259091/nginx-log-rotation-doesnt-seem-to-be-working-correctly
Looking at that answer, on our servers I changed the line:
to:
instead and now things appear to be working as expected now. Not sure why the default logrorate config for these Ubuntu and Debian boxes aren't doing that already but
rotate
does not seem to be working as maybe it was intended?