How to manage domain log rotation in Plesk

November 27, 2023 / Plesk

In Plesk, log rotation for a domain refers to the process of managing and maintaining log files by occasionally archiving and/or deleting older logs to stop them from consuming excessive disk space. Log rotation is essential for keeping the server storage organised and avoiding potential issues related to disk space exhaustion.

Via control panel –

  1. Log in to Plesk.
  2. Select “Domains” option under “Hosting Services”.
    domains
  3. Select the domain whose log rotation you wish to manage.
    log rotation
  4. Click on the “Logs” option.
    logs
  5. You will enter the logs of that domain.
  6. Click on the “Log rotation”.
    domain log rotation
  7. A pop-up window will appear. Fill in the required parameters –
    1. Tick the “Log rotation” checkbox.
    2. Select the “Log rotation condition” by time or by size.
    3. Enter the maximum number of log files.
    4. Tick the “Compress log files” checkbox.
    5. Add the email address to email log files after Plesk retrieves data from log files of web and FTP servers.
  8. Finally, click on the “Ok” button.
    configure log rotation

Important notes –

  • When Log rotation is not enabled, log files will be retained indefinitely.
  • If the Maximum number of log files is configured as zero, all current log files will be deleted during log rotation.
  • ModSecurity log files undergo rotation based solely on their size.

Via command line interface –

  1. Access a Plesk server using SSH on Linux or RDP on a Windows Server. Once connected, employ the Plesk utility “plesk bin site” (on Windows Server, launch a command prompt with Administrator privileges).
  2. Commands are as follows-
    -log-rotate <true|false> – Log rotation status (default: true)
    -log-bysize <number>[B|K|M|G] – Enables log rotation by size
    -log-bytime <daily|weekly|monthly> – Enables log rotation by time (default: daily)
    -log-max-num-files <number> – Maximum number of log files to store
    -log-compress <true|false> – Log files compression (default: true)
    -log-email <email> – send logfiles to an email after rotation
  3. Example-
    The subsequent command activates log rotation, establishes a Log rotation condition of 5 MB, sets the Maximum number of log files to 3 days, enables log compression, and initiates an email with logfiles sent to [email protected]
    # plesk bin site –update example.com -log-rotate true -log-bysize 5M -log-max-num-files 3 -log-compress true -log-email [email protected]
  4. To disable sending emails about rotated log use the below command-
    # plesk bin site –update example.com -log-email ””

You can administer log rotation for a domain in Plesk through both the control panel and the command line.

Stay updated on insightful articles by regularly visiting our Knowledge Base (KB) section. If you need assistance, our support specialists are here to help.

Dominos Search