Enable access and error logging on all services

This commit is contained in:
2026-03-10 09:34:08 +00:00
parent 53a37dde34
commit c5e05ef777
16 changed files with 74 additions and 42 deletions

View File

@@ -12,6 +12,7 @@ events {
http {
include mime.types;
default_type application/octet-stream;
keepalive_timeout 65;
keepalive_requests 100000;
@@ -26,7 +27,25 @@ http {
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log;
# JSON format — preferred for log aggregators (ELK, Loki, Datadog, etc.)
log_format json_log escape=json
'{'
'"time":"$time_iso8601",'
'"remote_addr":"$remote_addr",'
'"method":"$request_method",'
'"uri":"$request_uri",'
'"status":$status,'
'"bytes_sent":$body_bytes_sent,'
'"request_time":$request_time,'
'"upstream_response_time":"$upstream_response_time",'
'"referer":"$http_referer",'
'"user_agent":"$http_user_agent",'
'"x_forwarded_for":"$http_x_forwarded_for",'
'"host":"$host"'
'}';
access_log /var/log/nginx/access.log json_log;
error_log /var/log/nginx/error.log;
sendfile on;