Question
How to anonymize IP addresses in log files in Plesk?
Answer
To anonymize IP addresses in log files, Login to Plesk and go to Tools & Settings > Server Settings > Anonymize IPs during log rotation.
Read more about this feature in Plesk Administrator Guide.
The feature nulls up the last octet of IPv4 and the last group of IPv6 addresses during rotation of the following logs:
/var/log/httpd/*
/var/log/nginx/*
/var/log/maillog
/var/www/vhosts/*/logs/*
The anonymization works for rotated logs only. Therefore, logs of services like Fail2ban that work only with active logs are not anonymized.
The CLI utility to manage IP anonymization is yet to be implemented:
The feature was implemented in the following products:
For older Plesk versions, the following workaround is available:
-
Login to Plesk via SSH.
-
Download the script:
# wget https://support.plesk.com/hc/en-us/article_attachments/360006368973/enable-ip-anonimization.sh.tar.gz
-
Unpack it and make executable:
# tar -xvf enable-ip-anonimization.sh.tar.gz && chmod +x enable-ip-anonimization.sh
-
Execute the script:
# enable-ip-anonimization.sh
Note: This solution will anonimyze IP addresses in AWStats and Webalizer starting from the update 17.8 #20.
Note: usage of AWStats is discouraged due to to the bug #PPPM-10655 – Old AWStats files are left in the directory.
Additional information
What does “Disable IP logging in IIS, FTP and mail logs” option in Plesk for Windows mean?