From 32a33ba94f7783b66160fd52e4326ac09993b5db Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Thu, 9 Mar 2023 10:54:28 -0500 Subject: [PATCH] improve HTTP request logging * add $upstream_cache_status * add '-$connection_requests' after $connection * enable subrequest logging $connection_requests makes it much easier to see connection reuse in the logs and also helps to understand subrequests. --- nginx/nginx.conf | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nginx/nginx.conf b/nginx/nginx.conf index c0595e2..67b469a 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -72,11 +72,12 @@ http { # maintained by certbot-ocsp-fetcher ssl_stapling_file ocsp-cache/matrix.grapheneos.org.der; - log_format main '$connection $remote_addr $remote_user $ssl_protocol $server_protocol ' + log_format main '$connection-$connection_requests $remote_addr $remote_user $ssl_protocol $server_protocol ' '$host $request_method "$request_uri" $status $request_length $body_bytes_sent/$bytes_sent ' '$request_time $upstream_connect_time/$upstream_header_time/$upstream_response_time ' - '"$http_referer" "$http_user_agent"'; + '$upstream_cache_status "$http_referer" "$http_user_agent"'; access_log syslog:server=unix:/dev/log,nohostname main; + log_subrequest on; log_not_found off; gzip_proxied any;