Log Rotation on cPanel Servers

  WHM

Introduction

Some cPanel Specific logs are rotated by a daemon called cpanellogd and are managed through WHM.

Some cPanel related logs are rotated by the logrotated utility. The logrotated configuration of these logs is managed by cPanel and does not need to be modified manually.


Any new or custom logs implemented on the server would require a custom logrotated configuration. The process of generating a custom log rotation configuration for your new log is a task that you’ll need to work on with a third party systems administrator.

This guide provides information about how to manage log rotation on your cPanel server.

The cpanellogd Managed Log Rotation

The logs located under /usr/local/cpanel/logs are rotated by the cpanellogd daemon.

You can enable and disable log rotation for these logs in WHM at:

Home »Service Configuration »cPanel Log Rotation Configuration

cPanel Specific logrotated Configurations

cPanel maintains the log rotation configurations for software such as PHP FPM, suPHP, etc in the following directory:

/etc/logrotate.d/

All Other Log Rotation

All other logs are also managed by the logrotated utility and should either have an entry in /etc/logrotate.conf, or a configuration file in /etc/logrotate.d.

If you need to add a log rotate configuration for a log that is not already configured, you would need to use the following command to read the logrotated manual for the details:

man logrotate

However one way to quickly start  out would be to copy an existing log rotation configuration and then customize it to match the file path of your custom log.

The logrotated utility makes use of anacron, so your configuration will be used the next time logrotated is configured to run in:

/etc/cron.daily/logrotate

LEAVE A COMMENT