Table of Contents

cPanel Log Rotation Configuration

Within cPanel, numerous incidents are stored in the log files. The log files are located in the directory /usr/local/cpanel/logs that holds various types of logs like Error log, Access log, backups logs, and much more.

When there is an issue with the server and we cannot identify the exact issue, the server log will aid us in determining the main cause of the problem. Sometimes these log files themselves cause issues to the server as the server log entries are continuously adding information that becomes unmanageable at some point. Occasionally, the log files might become so large that it becomes impossible to store them without adding extra storage to the hosting plan or a VPS.

Log rotation is a feature that resolves these types of issues. Data from the location /usr/local/cpanel/logs can be selected and rotated based on their size. The rotated files will be compressed and stored in /usr/local/cpanel/logs/archive/.

The file names include the month in which they are rotated. Hence, the file names do not correspond in any way to the content of the file being rotated. Files are only rotated when they exceed the Log Rotation Size Threshold setting or the default of 300MB. The archived log files are retained indefinitely. Files not selected here will never be rotated by cPanel software.

Enabling Log Rotation Instructions for Specific Log Files

1) Sign in to WHM.

2) Go to the option ‘Service Configuration’.

 Log Rotation


3) Click on the option ‘cPanel Log Rotation Configuration’.

 Log Rotation

4) Check the appropriate checkboxes next to the log files that you wish to retain indefinitely.

Log Rotation

Once you have selected all the files you want to rotate, click on the ‘Save’ button to apply the changes. The system will not automatically delete the compressed log files. You must manually delete any unnecessary log files. The default log rotation size will be set to 300mb; you can also specify a custom threshold above which the cpanellogd daemon will rotate the log files. You can update these settings from -> WHM >> Home >> Server Configuration >> Tweak Settings.

Let us know if you need more assistance with log rotation in cPanel. We will assist you as soon as possible.

Post Your Comment