I have setup individual log files for each of my sites in the directory
/var/log/nginx-hosts/
and I have to configure log rotation for those files. The base I am starting with is
/var/log/nginx-hosts/*.log {
rotate 7
daily
missingok
notifempty
sharedscripts
copytruncate
compress
}
however, just like apache it appears that nginx has to be shut off pre-rotation in order to actually truncate them. The current nginx logrotate configuration is:
/var/log/nginx/*.log {
daily
missingok
rotate 52
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
[ ! -f /var/run/nginx.pid ] || kill -USR1 `cat /var/run/nginx.pid`
endscript
}
should I incorporate the individual site log rotation into the primary or work to figure out the first config in a different file. thoughts? ideas?
thank you for your help and happy holidays.
after digging further, here is how I fixed this issue: