Sunday, 15 December 2013

Log rotation in cPanel

 Files are only rotated when they grow larger than the value 300MB which is set at cpanel >> Tweak >> Log rotation size threshold, currently set as 300 MB default.

You can have the log rotation checked from under

Main >> Service Configuration >> cPanel Log Rotation Configuration


Inorder to  rotate the btmp, chkservd.log and brcm-iscsi.log I have made changes to the logrotate.conf file located in the /etc directory.

/var/log/chkservd.log {
weekly
rotate 1
}

To add insult to injury, cPanel is not rotating its own logs either.  Place this in the same file we have been editing:
/usr/local/cpanel/logs/stats_log {
weekly
rotate 1
}

/usr/local/cpanel/logs/access_log {
weekly
rotate 1
}

/usr/local/cpanel/logs/error_log {
weekly
rotate 1
}

/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
}


/var/log/btmp {

monthly

minsize 1M

create 0600 root utmp

rotate 1

}

No comments:

Post a Comment