Applicable to:
- Plesk for Linux
Symptoms
-
Logs are not being rotated for one or several domains.
-
The date the logs of the domain example.com have been rotated last time is long ago:
# grep example.com /usr/local/psa/var/logrotate.status
"/var/www/vhosts/system/example.com/logs/error_log" 2019-8-28
"/var/www/vhosts/system/example.com/logs/access_log.processed" 2019-8-28
"/var/www/vhosts/system/example.com/logs/access_ssl_log.processed" 2019-8-28
"/var/www/vhosts/system/example.com/logs/proxy_error_log" 2019-8-28 -
The following error might be found in
/var/log/plesk/panel.log
:CONFIG_TEXT: Log rotation '/usr/local/psa/logrotate/sbin/logrotate /usr/local/psa/etc/logrotate.conf -s /usr/local/psa/var/logrotate.status' failed with code 1.
Stdout:
Stderr:error: line 4332 too long in state file /usr/local/psa/var/logrotate.status
error: could not read state file, will not attempt to write into it
Cause
The /usr/local/psa/var/logrotate.status
file got corrupted.
This file is where logrotate stores information about when each log file has been last rotated.
Resolution
-
Connect to the server via SSH
-
Move
/usr/local/psa/var/logrotate.status
file:# mv /usr/local/psa/var/logrotate.status /usr/local/psa/var/logrotate.status_old
-
Run daily maintenance task is charge of statistics calculation and log rotation:
# plesk daily ExecuteStatistics
Note: depending of the number of domains hosted, this operation might take some time, thus consider waiting for the next automatic execution of daily tasks.
-
Check if the
logrotate.status
file is successfully regenerated:# grep example.com /usr/local/psa/var/logrotate.status
"/var/www/vhosts/system/example.com/logs/error_log" 2020-8-28
"/var/www/vhosts/system/example.com/logs/access_log.processed" 2020-8-28
"/var/www/vhosts/system/example.com/logs/access_ssl_log.processed" 2020-8-28
"/var/www/vhosts/system/example.com/logs/proxy_error_log" 2020-8-28When extra domains are added to the subscription, configure them by following the article How to configure log rotation for domain?
Comments
1 comment
Hi Renan Poss Moreira
There might be a BUG where some log files are just NOT called to be rotated... as:
/var/www/vhosts/system/example.com/logs/access_ssl_log
/var/www/vhosts/example.com/logs/access_ssl_log
Which seems not to-be called to be hardlinked...
Please sign in to leave a comment.