- Plesk 12.5 for Windows
How to remove Plesk logs on a monthly basis automatically in Plesk for Windows based on the last modification date?
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:
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
Save this script to any location, for example, to C:\removelogs.ps1
Open Task Scheduler and create a new task with the following actions:
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.