Question
How to manage log rotations on cPanel servers to reduce log sizes?
Answer
The cPanel Log Rotation Configuration interface controls many cPanel logs. You can toggle the rotation on and off with the checkboxes. The Log rotation size threshold setting in WHM Home / Server Configuration / Tweak Settings controls how often the cPanel Logd (cpanellogd) service automatically rotates logs.
| Log rotation size threshold | This setting allows you to specify a threshold above which the cpanellogd daemon rotates log files. This setting does not apply to the Apache domlogs. |
| 300 MB |
Other log files that are managed by the system packages or EA4 are controlled by logrotated utility.
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/.
Other Log Rotation
Other system 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. This will be dependent on whether the system package provides a logrotate.d configuration file.
If you need to add a log rotation configuration for a log that is not already configured, you would need to use the following command to read the logrotate 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.
Comments
0 comments
Article is closed for comments.