From 3e4c5536c352481db16a79101baa042c9604d0e8 Mon Sep 17 00:00:00 2001 From: nadeemshahzad Date: Tue, 1 Oct 2024 12:15:11 +0500 Subject: [PATCH] chore: standardize Nginx Log Format for Datadog Integration --- playbooks/roles/nginx/templates/etc/nginx/nginx.conf.j2 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/playbooks/roles/nginx/templates/etc/nginx/nginx.conf.j2 b/playbooks/roles/nginx/templates/etc/nginx/nginx.conf.j2 index 1c3494e5434..5da1b48e260 100644 --- a/playbooks/roles/nginx/templates/etc/nginx/nginx.conf.j2 +++ b/playbooks/roles/nginx/templates/etc/nginx/nginx.conf.j2 @@ -68,9 +68,10 @@ http { 'upstream_connect_time=$upstream_connect_time upstream_header_time=$upstream_header_time'; {% if NGINX_ENABLE_REQUEST_TRACKING_ID -%} - log_format cf_custom '$http_x_forwarded_for - $remote_addr - $remote_user $http_x_forwarded_proto [$time_local] $request_tracking_id ' - '"$request" $status $body_bytes_sent $request_time ' - '"$http_referer" "$http_user_agent"'; + log_format cf_custom '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent $request_time "$http_referer" "$http_user_agent" ' + '$http_x_forwarded_for $http_x_forwarded_proto $request_tracking_id'; + {% endif %} log_format json_analytics escape=json '{'