From 9de678984c3e2e51894793316b1ba434694bff2b Mon Sep 17 00:00:00 2001 From: clerie Date: Wed, 15 Mar 2023 20:26:44 +0100 Subject: [PATCH] Anonymized nginx access logs --- configuration/common/default.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/configuration/common/default.nix b/configuration/common/default.nix index 07cf46e..8fd421b 100644 --- a/configuration/common/default.nix +++ b/configuration/common/default.nix @@ -69,8 +69,17 @@ recommendedProxySettings = true; recommendedTlsSettings = true; - appendHttpConfig = '' + commonHttpConfig = '' server_names_hash_bucket_size 64; + map $remote_addr $remote_addr_anon { + ~(?P\d+\.\d+\.\d+)\. $ip.0; + ~(?P[^:]*:[^:]*(:[^:]*)?): $ip::; + default ::; + } + log_format combined_anon '$remote_addr_anon - $remote_user [$time_local] ' + '"$request" $status $body_bytes_sent ' + '"$http_referer" "$http_user_agent"'; + access_log /var/log/nginx/access.log combined_anon; ''; virtualHosts = {