Limit log to certain file types

This commit is contained in:
Simon Bruder 2020-11-25 21:22:26 +01:00
parent 4b17d66ed4
commit e54bc97477
No known key found for this signature in database
GPG key ID: 6F03E0000CC5B62F

View file

@ -17,7 +17,7 @@
# privacy-aware log format # privacy-aware log format
log_format custom '$remote_addr_anon - - [$time_local] "$request" $status $body_bytes_sent "-" "$http_user_agent"'; 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 { map $remote_addr $remote_addr_anon {
~(?P<ip>\d+\.\d+)\. $ip.0.0; ~(?P<ip>\d+\.\d+)\. $ip.0.0;
@ -38,6 +38,13 @@
enableACME = true; enableACME = true;
forceSSL = true; forceSSL = true;
root = "/var/www/"; 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}" = { "www.${config.deployment.targetHost}" = {