Plesk rotates logs using the
logrotate utility. This is located in the
$PRODUCT_ROOT_D/logrotate/sbin/logrotate directory, where the
/usr/local/psa for RPM-based systems or
/opt/psa on DEB-based systems.
You can set the following parameters of logs rotation:
- Log rotation condition. This may be one of the following:
- Size - Plesk rotates logs when their size exceeds a particular limit.
- Time - daily, weekly, or monthly logs rotation.
- Maximum number of log files.
- Log compression. Enable this, if you want Plesk to compress log files to gzip archives.
- Email to which Plesk should send processed log files.
Log Rotation Settings of Plesk Services
You can define log rotation parameters for Plesk services in general and for each domain separately.
Log rotation parameters for Plesk services are defined in the
$PRODUCT_ROOT_D/etc/logrotate.conf configuration file. Part of this file is shown below.
Log Rotation Settings of Hosted Domains
In turn, log rotation parameters for domains hosted on the Plesk server are stored in configuration files in the
You can configure log rotation for a particular domain through the Plesk GUI. To do this:
- Log in to Plesk and go to the subscription.
- In Website & Domains, click Logs under the domain for which you want to change log rotation settings.
- Click the icon on the top right and click Manage Log Files.
- Click Log Rotation.
- Change the log rotation configuration if needed.
When you click OK, the configuration is saved in the domain
logrotate configuration file
>. A fragment of this file is provided below. Configuration changes are applied equally for all log files of this domain.
Adding Creation Date to Rotated Log File Names
To make working with log files more convenient, you can include the file creation date into the names of rotated log files. If you do this, the names of rotated log files will have the following format <log_name>
.processed-YYYYMMDD.gz, where <log_name> is the name of the log file before rotation, like
YYYYMMDD is the date of the log rotation. For example,
To include the creation date into the names of rotated log files, open the desired log rotation configuration file and add the line
dateext to the corresponding sections.