From e54bc9747737255cb26ffee88a38638f6e5619f7 Mon Sep 17 00:00:00 2001 From: Simon Bruder Date: Wed, 25 Nov 2020 21:22:26 +0100 Subject: [PATCH] Limit log to certain file types --- deploy.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/deploy.nix b/deploy.nix index d0b6be2..6528e44 100644 --- a/deploy.nix +++ b/deploy.nix @@ -17,7 +17,7 @@ # privacy-aware log format log_format custom '$remote_addr_anon - - [$time_local] "$request" $status $body_bytes_sent "-" "$http_user_agent"'; - access_log /var/log/nginx/access.log custom; + access_log off; map $remote_addr $remote_addr_anon { ~(?P\d+\.\d+)\. $ip.0.0; @@ -38,6 +38,13 @@ enableACME = true; forceSSL = true; root = "/var/www/"; + + # only log page views, rss feed access, media file download and embed views + extraConfig = '' + location ~ index\.html|rss\.xml|\.(opus|m4a|ogg|mp3|\.podlove.json)$ { + access_log /var/log/nginx/access.log custom; + } + ''; }; "www.${config.deployment.targetHost}" = {