I have been running apache webserver on an lower end old PC (PII450/192RAM/10GHD) for two years now and it never gave me problem.
But today I found out my apache log file never got rotated since I upgrade apache to apache2 with openssl and WebDav support. After couple of minutes of poking around, the log file got rotated, here is what I did, change /etc/logrotate.d/apache2
/var/log/apache2/*.log {
weekly
missingok
rotate 52
compress
delaycompress
notifempty
create 640 root adm
sharedscripts
postrotate
if [ -f /var/run/apache2.pid ]; then
/etc/init.d/apache2 restart > /dev/null
fi
endscript
}
to:
/usr/local/apache2/logs/*_log {
weekly
missingok
rotate 52
compress
delaycompress
notifempty
create 640 www-data www-data
sharedscripts
postrotate
if [ -f /usr/local/apache2/logs/httpd.pid ]; then
/usr/local/apache2/bin/apachectl restart > /dev/null
fi
endscript
}
and manually run logrotate /etc/logrotate.conf. logrotate is called from /etc/cron.daily, so the apache log will be rotated weekly.
But today I found out my apache log file never got rotated since I upgrade apache to apache2 with openssl and WebDav support. After couple of minutes of poking around, the log file got rotated, here is what I did, change /etc/logrotate.d/apache2
/var/log/apache2/*.log {
weekly
missingok
rotate 52
compress
delaycompress
notifempty
create 640 root adm
sharedscripts
postrotate
if [ -f /var/run/apache2.pid ]; then
/etc/init.d/apache2 restart > /dev/null
fi
endscript
}
to:
/usr/local/apache2/logs/*_log {
weekly
missingok
rotate 52
compress
delaycompress
notifempty
create 640 www-data www-data
sharedscripts
postrotate
if [ -f /usr/local/apache2/logs/httpd.pid ]; then
/usr/local/apache2/bin/apachectl restart > /dev/null
fi
endscript
}
and manually run logrotate /etc/logrotate.conf. logrotate is called from /etc/cron.daily, so the apache log will be rotated weekly.