Symptoms
Awstats *.txt
data files (such as ones stored under /var/www/vhosts/system/example.com/statistics/webstat
) are kept longer than set within the retention policy settings of the server/service plan/subscription:
- Tools & Settings > Server Settings > Retain web and traffic statistics for;
- Service Plans > plan_name > Logs & Statistics > Retain web and traffic statistics for;
- Subscriptions > example.com > Customize > Logs & Statistics > Retain web and traffic statistics for.
Cause
Product issue:
-
#PPPM-10655 “AWStats TXT files are now completely removed after the corresponding TTL has expired.”
Fixed in:- Plesk Obsidian 15 September 2020 (Linux)
Resolution
Please consider updating your server:
Workaround
If update is not possible for some reason you may try the following
workaround
For GDPR compliant environment, use Webalizer with IP addresses anonymization.
As a workaround for AWStats on Linux server, use the following steps:
-
Connect to the server via SSH.
-
Create a script
/root/awstats_cleanup.sh
with the following content:#!/bin/bash
for i in $(ls -d /var/www/vhosts/system/*/statistics/webstat*/); do
find $i -ctime +$1 -exec rm -rf {} +;
done
echo "Web statistics files older than" $1 "day(s) are removed";
exit -
Create a task with the following content in Tools & Settings > Scheduled Tasks:
/bin/bash /root/awstats_cleanup.sh 90
Where 90 is the number of days to retain traffic statistics files.