Running WHM 11.24.2 on RHEL.
I've only recently understood that there are some issues with log rotation on WHM/cPanel systems, and that it might take some customization to make rotation work in a nice way. Which is kind of strange since just about everything else about WHM/cPanel seems to be designed to be handled by anyone who can handle a keyboard and a mouse.
Yes, I know there are settings in WHM ("Apache Configuration" and "cPanel Log Rotation Configuration") that makes WHM handle rotation for files in/usr/local/apache/logs
/usr/local/cpanel/logs
But Apache files seem to be rotated only above 300MB?
Well, I like my files smaller than that and therefore want to use a custom log rotation.
Additionally, it seems some files are not covered by the above settings - these were mentioned somewhere:/var/log/xferlog
/var/log/chkservd.log
And what about files in /usr/local/cpanel/logs/cpbackup, do they stick around for ever?
I've added the below lines to my /etc/logrotate.conf, and would love some input from a WHM guru on their sanity and completeness.
I've used the "service" binary rather than "kill -HUP", doing a hard restart of pure-ftpd but restarting apache gracefully. Is this the way to do it?
/var/log/xferlog {
weekly
rotate 1
postrotate/sbin/service pure-ftpd restart > /dev/null 2>/dev/null || true
endscript
}
/var/log/chkservd.log {
weekly
rotate 1
}
/usr/local/cpanel/logs/cpbackup/*.log {
weekly
rotate 1
}
/usr/local/cpanel/logs/*log {
weekly
rotate 1
}
/usr/local/apache/logs/*log {
daily
rotate 7
sharedscripts
postrotate/sbin/service httpd graceful > /dev/null 2>/dev/null || true
endscript
}