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
7 comments
CentOS 7.4, Plesk Version 17.5.3 Update #35
When you've added extra domains to your subscription, check "Websites & Domains/Logs/Manage Log Files"
Then go to "Log Rotation"
When the Maximum number of log files is 0, the log files won't rotate. Change it to eg. 5
Run /usr/local/psa/bin/sw-engine-pleskrun /usr/local/psa/admin/plib/DailyMaintainance/script.php
@Andries Jansen
Thank you for additional details, I've added some details to an already existing article How to configure log rotation for domain?
And how can i rotate the logs for only one domain?
# /usr/local/psa/logrotate/sbin/logrotate -v -f /usr/local/psa/etc/logrotate.d/example.com
this not work for me
seems that some domains in /usr/local/psa/etc/logrotate.d/ not exist. why?
Hello @Luis,
> And how can i rotate the logs for only one domain?
I have verified the command "/usr/local/psa/logrotate/sbin/logrotate -v -f /usr/local/psa/etc/logrotate.d/example.com", it worked fine.
What output of the command is shown to you? Could you, please, provide it.
> seems that some domains in /usr/local/psa/etc/logrotate.d/ not exist. why?
This is not expected behavior. There is a possibility that such behavior is caused by issue with logrotate execution.
As of 9-Mar-2022 on our Plesk servers I have noticed that the access_ssl_log.processed files are growing in size without being rotated. There were also Plesk updates that same day. I tried using the rotation fixes, but it did not help and all of the configs look correct. Is this a new bug?
Neil Beattie If you applied the fix and the error is still present I believe additional investigation is required, please feel free to open a support ticket so we can check further!
Please sign in to leave a comment.