[tor-mirrors] Privacy respecting logging

Alexander Dietrich alexander at dietrich.cx
Tue Oct 23 22:13:36 UTC 2018


On 2018-10-23 23:21, Traumschule wrote:
> 
> For apache you can use the libapache2-mod-removeip. For nginx
> AFAIK there's no such module. Found this example to modify log_format
> https://www.hagen-bauer.de/2015/12/nginx-logfiles-anon.html in german.
> If you know about better instructions in english, let us know!

nginx logging is documented here:
https://nginx.org/en/docs/http/ngx_http_log_module.html

The default log format is given as:

log_format combined '$remote_addr - $remote_user [$time_local] '
                     '"$request" $status $body_bytes_sent '
                     '"$http_referer" "$http_user_agent"';

So if you wanted to suppress IP and user information, while staying 
compatible with the Common Log Format, and drop the HTTP Referer and 
User-Agent fields, you could add these lines to your nginx.conf:

log_format privacy '- - - [$time_local] "$request" $status 
$body_bytes_sent';
access_log /var/log/nginx/access.log privacy;

You may need to change the second line if your nginx log files are not 
in /var/log/nginx.

Kind regards,
Alexander


More information about the tor-mirrors mailing list