How To Setup Cpanel and Apache Log Rotation

Different kind of logs keep increasing on server and should be set to move else they can cause problem, one is that when any log file gets to 2 Gb it can generally outcome in Apache service failure or in common they can take up very huge disk space.To take care of this problem , cPanel web servers offer the choice to set rotation for the logs from WHM gui. For cPanel logs the rotation for logs located at /usr/local/cpanel/logs can be setup using below link in WHM :

Main >> Service Configuration >> cPanel Log Rotation Configuration

Similarly for Apache logs located at /usr/local/apache/logs the rotation can be setup with the following link in WHM :

Main >> Service Configuration >> Apache Configuration >> Log Rotation

And for both of these the threshold for the log file size can be set using below link in WHM (the default size is 300Mb ):

Main >> Server Configuration >> Tweak Settings

The exact section and option under Tweak Settings is :

Stats and Logs >> Threshold in megabytes above which cpanellogd will rotatelog files configured for log rotation. (Minimum 10MB)

If you face any issue while finding log files location,You may check our article on cPanel log locations.