Articles in this section

How to set up forced log rotation for all domains in Plesk

Plesk for Windows DoNotDelete:docref kb: how-to Plesk for Linux ABT: Group A

Applicable to:

  • Plesk for Linux
  • Plesk for Windows

Question

A GDPR-related regulation prohibits storing clients' IP addresses on the server after a certain period of time. How to set up forced log rotation for all domains?

Answer

Use the most suitable of the available methods to set up forced log rotation for all domains at once in Plesk:

Plesk UI
  1. Log into Plesk
  2. Go to Tools & Settings > Server Settings;
  3. Enable option Force daily log rotation for all domains and specify how long logs will be kept:
    Click Install
CLI (Linux)
  1. Connect to the server via SSH.
  2. Run the following commands to enable forced log rotation using logrotate_force and set the number of days using logrotate_period, which applies that for newly created domains and service plans only:

    # plesk bin settings -s logrotate_force=true
    # plesk bin settings -s logrotate_period=8

  3. Run the following command to apply the setting to all existing domains, where N is the number of files to keep:

    # plesk bin domain -l | while read d; do plesk bin domain -u $d --log-bytime daily --log-max-num-files N; done

  4. Run the following command to update system log files rotation, where N is the number of files to keep:

    # plesk sbin logrot_mng --system-logs --period-type=by_time --period=daily --rot-count=N

CLI (Windows)
  1. Connect to the server via RDP
  2. Open the Windows Command Prompt as Administrator
  3. Run the following commands to enable forced log rotation using logrotate_force and set the number of days using logrotate_period, which applies that for newly created domains and service plans only:

    C:\> plesk bin settings -s logrotate_force=true

    C:\> plesk bin settings -s logrotate_period=8

  4. Run the following command to apply the setting to all existing domains, where N is the number of files to keep:

    C:\> for /f "delims=" %d in ('plesk bin domain -l') do plesk bin domain -u "%d" -log-bytime daily -log-max-num-files N

     

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.