From 7a6e4e596f3634c1c768b1950b42b630552fbe0c Mon Sep 17 00:00:00 2001 From: Timo Makinen Date: Thu, 23 Jan 2025 05:53:44 +0000 Subject: [PATCH] nginx: Use custom log format --- roles/nginx/templates/nginx.conf.j2 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/roles/nginx/templates/nginx.conf.j2 b/roles/nginx/templates/nginx.conf.j2 index 0a503cc..b6733d2 100644 --- a/roles/nginx/templates/nginx.conf.j2 +++ b/roles/nginx/templates/nginx.conf.j2 @@ -8,7 +8,10 @@ events { } http { - access_log {{ nginx_logdir }}/access.log combined; + log_format custom '$remote_addr - $remote_user [$time_local] ' + '"$request" $status $body_bytes_sent ' + '"$http_referer" "$http_user_agent" ($request_time)'; + access_log {{ nginx_logdir }}/access.log custom; proxy_ssl_certificate {{ tls_certs }}/{{ inventory_hostname }}.crt; proxy_ssl_certificate_key {{ tls_private }}/{{ inventory_hostname }}.key;