Replaced main logger with JSON formatting

This commit is contained in:
2024-03-07 16:42:20 +01:00
parent 6cf68a52d2
commit 033cb52696
2 changed files with 15 additions and 4 deletions

View File

@@ -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
...

View File

@@ -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;