website/content/blog/privacy-friendlier-nginx-logging.md
2022-04-10 13:07:40 +02:00

27 lines
726 B
Markdown

---
title: "Privacy friendlier Nginx logging"
author: "Vrifox"
date: 2021-05-15T21:49:54+02:00
featured_image:
categories:
tags:
draft: true
type: "post"
---
Yesterday I changed the logging behaviour of my nginx. I did this to make it more privacy friendly and to declutter my log files. \
The ip address anonymization part is taken from [Ascraues Privacy Policy ](https://ascraeus.org/page/privacy/).
```
map $remote_addr $anon_remote_addr {
~(?P<ip>\d+\.\d+)\. $ip.0.0;
~(?P<ip>[^:]+:[^:]+): $ip::;
default 0.0.0.0;
}
log_format privacy '$anon_remote_addr [$time_local] '
'"$request" $status $bytes_sent ';
access_log /var/log/nginx/access.log privacy;
```