Articles in this section

Log rotation doesn't work for a particular domain in Plesk: error creating output file

Plesk for Linux kb: technical

Applicable to:

  • Plesk for Linux

Symptoms

  • Logs are not being rotated on daily basis for a particular domain, e.g example.com.

  • Running logrotate utility fails with the following error:

    # /usr/local/psa/logrotate/sbin/logrotate -v -f /usr/local/psa/etc/logrotate.conf
    copying /var/www/vhosts/system/example.com/logs/error_log to /var/www/vhosts/system/example.com/logs/error_log.1
    error: error creating output file /var/www/vhosts/system/example.com/logs/error_log.1: File exists

Cause

Temporary logrotate files were not removed due to an unexpected interruption of the log rotation task.

Resolution

  1. Connect to the server via SSH

  2. Find the temporary logrotate files causing this issue:

    Note: The temporary logrotate files can be identified by suffix ".1"

    # ls -lha /var/www/vhosts/system/*/logs/*.[0-9]
    -rw-r--r-- 2 root root 0 nov 4 2020 /var/www/vhosts/system/example.com/logs/error_log.1
    -rw-r--r-- 2 root root 0 nov 2 2020 /var/www/vhosts/system/example.com/logs/proxy_error_log.1
    -rw-r--r-- 2 root root 0 nov 2 2020 /var/www/vhosts/system/example.com/logs/access_log.processed.1

  3. Rename the invalid temporary logrotate files:

    # find /var/www/vhosts/system/*/logs/*.[0-9] -exec mv {} {}.invalid \;

  4. Run the logrotate utility to verify the logs are rotated as expected:

    # /usr/local/psa/logrotate/sbin/logrotate -v -f /usr/local/psa/etc/logrotate.conf

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.