diff --git a/.drone.yml b/.drone.yml index 6e6e9b9..b8b9529 100644 --- a/.drone.yml +++ b/.drone.yml @@ -47,6 +47,7 @@ trigger: - pull_request branch: - main + - feat/nginx-json-logs depends_on: - Build @@ -107,6 +108,7 @@ trigger: - pull_request branch: - main + - feat/nginx-json-logs depends_on: - Build @@ -118,6 +120,6 @@ volumes: --- kind: signature -hmac: 09d1d630e540afad36b45ad1df42ab8bb9675218fc567872f2916ca0614c7ee7 +hmac: aea9d888a8d4261c7f1d654fe5d9e1fe5aee95e565bb689251eae23d8c4a41a2 ... diff --git a/nginx.conf b/nginx.conf index 79b77a8..c0406ca 100644 --- a/nginx.conf +++ b/nginx.conf @@ -14,9 +14,18 @@ http { include /etc/nginx/mime.types; default_type application/octet-stream; - log_format main '$remote_addr - $remote_user [$time_local] "$request" ' - '$status $body_bytes_sent "$http_referer" ' - '"$http_user_agent" "$http_x_forwarded_for"'; + log_format main escape=json + '{' + '"time_local":"$time_local",' + '"remote_addr":"$remote_addr",' + '"remote_user":"$remote_user",' + '"request":"$request",' + '"status": "$status",' + '"body_bytes_sent":"$body_bytes_sent",' + '"request_time":"$request_time",' + '"http_referrer":"$http_referer",' + '"http_user_agent":"$http_user_agent"' + '}'; access_log /var/log/nginx/access.log main;