I am using Apache2 on Ubuntu 20.04. The access.log and error.log files are automatically rotated every day at midnight UTC. How do I change the time so that it, for example, rotates at 11:00 UTC?
This is the default config (/etc/logrotate.d/apache2), which I have not touched:
/var/log/apache2/*.log {
daily
missingok
rotate 14
compress
delaycompress
notifempty
create 640 root adm
sharedscripts
postrotate
if invoke-rc.d apache2 status > /dev/null 2>&1; then
invoke-rc.d apache2 reload > /dev/null 2>&1;
fi;
endscript
prerotate
if [ -d /etc/logrotate.d/httpd-prerotate ]; then
run-parts /etc/logrotate.d/httpd-prerotate;
fi;
endscript
}
FYI, the reason I want to do this is that the rotation's associated graceful restart can sometimes cause an "Unable to connect to WSGI daemon process" issue, which is only solved by my doing a regular restart. Eventually, I'd like to solve that, but for now it's OK if I can just make sure that it happens at a more convenient time for me and my users.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…