bundles/nginx: add anonymous timing logging for http requests
All checks were successful
bundlewrap/pipeline/head This commit looks good

This commit is contained in:
Franzi 2021-06-05 15:53:02 +02:00
parent 72d4826dbb
commit db83b1614b
Signed by: kunsi
GPG key ID: 12E3D2136B818350
7 changed files with 216 additions and 0 deletions

View file

@ -0,0 +1,28 @@
/var/log/nginx/*.log {
compress
copytruncate
create 0640 www-data adm
daily
dateext
missingok
notifempty
rotate ${node.metadata.get('nginx/log_retention_days', 7)}
sharedscripts
prerotate
if [ -d /etc/logrotate.d/httpd-prerotate ]; then \
run-parts /etc/logrotate.d/httpd-prerotate; \
fi
endscript
}
/var/log/nginx-timing/*.log {
compress
copytruncate
create 0644 www-data adm
dateext
missingok
notifempty
rotate 3
sharedscripts
size 1M
}

View file

@ -50,9 +50,12 @@ http {
default 0.0.0.0;
"~(?P<ip>.*)" $ip;
}
log_format gdpr '$ip_anonymized - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"<stripped>" "$http_user_agent"';
log_format anon_timing '[$time_local] $request_time $upstream_response_time "$request" $status';
include /etc/nginx/sites/*;
}

View file

@ -54,6 +54,12 @@ server {
resolver 8.8.8.8 8.8.4.4 valid=300s;
resolver_timeout 5s;
% if create_access_log:
access_log /var/log/nginx/access-${vhost}.log gdpr;
% endif
access_log /var/log/nginx-timing/${vhost}.log anon_timing;
# error_log is disabled globally
% if max_body_size:
client_max_body_size ${max_body_size};
% elif proxy or php: