Plesk

How to set up log storage for a long term in Plesk?

Question

The local laws of my country require storing all server logs for a long period. How do I set up storing of websites' logs for years in Plesk?

Important

Answer

To set up a non-standard period of log storage, apply the following:

  1. To keep sensitive data safe, disable the IP addresses anonymization in Plesk: Go to Tools & Settings > Server Settings, clear the Anonymize IP addresses during log rotation and collecting of web statistics checkbox and click OK:

  2. Download and configure the actual version of archive-logs.sh script.

    Note: the corresponding repository may be found here.

  3. Set a scheduled task to run a script in a periodic manner.

Find detailed instruction on how to use the archive-logs.sh script below.

Script

How it works

By default, this script collects all known logs of the server, Plesk, and websites. You can view the list of the collected logs right in the script and modify it in a configuration file if required.

To get a list of available options, run the script with the --help option:

# ./archive-logs.sh --help
Usage: archive-logs [OPTIONS]
Collect and transfer logs for long-term storage.

-c, --config CONFIG
Use this config…