Question
Web statistics tools operate by processing information from log files, including visitors' IP addresses. How to disable IP address logging in case this is considered a GDPR violation?
Answer
To ensure that the server is GDPR compliant without disabling web statistics completely, disable IP address logging. But this way, the quality of statistics reports will decrease.
Note: if IP address logging is disabled, security tools like Fail2ban will stop working. Consider the implications of both options before decision is made.
Disabling IP address logging in Apache
- Login to Plesk via SSH
- Create a custom templates directory:
# install -m 0755 -d /usr/local/psa/admin/conf/templates/custom
- Copy server template to the custom directory:
# cp -f /usr/local/psa/admin/conf/templates/default/server.php /usr/local/psa/admin/conf/templates/custom/
- Modify the log format replacing '%a' with '-':
# perl -pi -e ‘s,%a,-,g/’ /usr/local/psa/admin/conf/templates/custom/server.php
- Reconfigure Apache:
# plesk sbin httpdmng --reconfigure-all
Disabling IP address logging in Nginx
- Login to Plesk via SSH
- Create a file named
/etc/nginx/conf.d/aa900_logs_without_ip.conf
with the following content:log_format noip '- - $remote_user [$time_local]'
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent"'; - Create custom templates directory:
# install -m 0755 -d /usr/local/psa/admin/conf/templates/custom/domain
- Copy original template to the custom directory:
# cp -f /usr/local/psa/admin/conf/templates/default/domain/nginxDomainVirtualHost.php /usr/local/psa/admin/conf/templates/custom/domain/
- Find a string beginning with 'access_log' and add 'noip' to the end of the string (before semicolon), so that it looks like this:
# access_log "<?php echo $VAR->domain->physicalHosting->logsDir . '/' .($OPT['ssl'] ? 'proxy_access_ssl_log' : 'proxy_access_log') ?>" noip;
- Reconfigure the web server:
# plesk sbin httpdmng --reconfigure-all
Additional information
If it is needed to completely disable the web statistics, check the article below: