From 7f617870261d07cd2c99ed90dcec6193cd4997ae Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Fri, 10 Feb 2023 04:49:07 -0500 Subject: [PATCH] switch to improved custom log format This switches to a fully custom log format instead of using a variant of the standard combined format since we don't use any tools requiring the logs to be a standard format. This provides a cleaner format, allows us to freely add new fields and gets rid of legacy/redundant fields. The redundant timestamp already provided as the syslog timestamp is dropped along with the legacy identd field always set to a dash. This adds the connection serial number for identifying requests coming from the same connection. TLS version is added as a replacement for our previous addition of the URI scheme. This also adds the total request length and total bytes sent to the client instead of only the body bytes sent. --- nginx/nginx.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nginx/nginx.conf b/nginx/nginx.conf index fb1e3fd..5b92823 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -64,8 +64,8 @@ http { # maintained by certbot-ocsp-fetcher ssl_stapling_file ocsp-cache/matrix.grapheneos.org.der; - log_format main '$remote_addr - $remote_user [$time_local] ' - '"$request_method $scheme://$host$request_uri $server_protocol" $status $body_bytes_sent ' + log_format main '$connection $remote_addr $remote_user $ssl_protocol $server_protocol ' + '$host "$request_uri" $status $request_length $body_bytes_sent/$bytes_sent ' '"$http_referer" "$http_user_agent"'; access_log syslog:server=unix:/dev/log,nohostname main; error_log syslog:server=unix:/dev/log,nohostname;