How to remove Plesk logs on a monthly basis automatically in Plesk for Windows?

Created:

2016-12-18 07:24:11 UTC

Modified:

2017-08-16 18:31:51 UTC

0

Was this article helpful?


Have more questions?

Submit a request

How to remove Plesk logs on a monthly basis automatically in Plesk for Windows?

Applicable to:

  • Plesk 12.5 for Windows

Question

How to remove Plesk logs on a monthly basis automatically in Plesk for Windows based on the last modification date?

Answer

Plesk allows removing logs for domains only. In order to schedule log files removal on a per domain basis, go to Domains > example.com > Logs > Log Rotation . Setup "Maximum number of log files" is required. For example, to remove all logs that are more than 1 month for 1 domain, set "Maximum number of log files" to 1 and "Log rotation condition" to "By Time > Monthly".

As for other logs, it is possible to arrange using Windows utilities. For example, using a script that will remove logs based on a certain condition in a Task Scheduler:

  1. Create a PowerShell script with the following content:

    FORFILES /P “C:\Program Files (x86)\Parallels\Plesk\admin\logs” /S /D -30 /C “CMD /C DEL /F /Q @PATH”

This script will remove all files located in C:\\Program Files (x86)\\Parallels\\Plesk\\admin\\logs and all sub-folders with the last modification date more than 30 days

  1. Save this script to any location, for example, to C:\removelogs.ps1

  2. Open Task Scheduler and create a new task with the following actions:

alttext

The same may be applied to any required folder. The list of Plesk logs is available here:

#213911325 Plesk for Windows service logs and configuration files

You may use any other script if required, since this is a system administrator task.

Have more questions? Submit a request
Please sign in to leave a comment.