Change log format to VCOMBINED for access logs and debug for error logs
This commit is contained in:
@@ -10,7 +10,7 @@ events {
|
|||||||
}
|
}
|
||||||
|
|
||||||
http {
|
http {
|
||||||
include mime.types;
|
include /etc/nginx/mime.types;
|
||||||
default_type application/octet-stream;
|
default_type application/octet-stream;
|
||||||
|
|
||||||
keepalive_timeout 65;
|
keepalive_timeout 65;
|
||||||
@@ -23,30 +23,31 @@ http {
|
|||||||
resolver 8.8.8.8 valid=30s ipv6=off;
|
resolver 8.8.8.8 valid=30s ipv6=off;
|
||||||
resolver_timeout 11s;
|
resolver_timeout 11s;
|
||||||
|
|
||||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
# log_format json_combined escape=json '{'
|
||||||
'$status $body_bytes_sent "$http_referer" '
|
# '"method":"$request_method",'
|
||||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
# '"scheme":"$scheme",'
|
||||||
|
# '"domain":"$host",'
|
||||||
# JSON format — preferred for log aggregators (ELK, Loki, Datadog, etc.)
|
# '"uri":"$request_uri",'
|
||||||
log_format json_log escape=json
|
# '"query_string":"$query_string",'
|
||||||
'{'
|
# '"referer":"$http_referer",'
|
||||||
'"time":"$time_iso8601",'
|
# '"content_type":"$sent_http_content_type",'
|
||||||
'"remote_addr":"$remote_addr",'
|
# '"status": $status,'
|
||||||
'"method":"$request_method",'
|
# '"bytes_sent":$body_bytes_sent,'
|
||||||
'"uri":"$request_uri",'
|
# '"request_time":$request_time,'
|
||||||
'"status":$status,'
|
# '"user_agent":"$http_user_agent",'
|
||||||
'"bytes_sent":$body_bytes_sent,'
|
# '"cache":"$upstream_cache_status",'
|
||||||
'"request_time":$request_time,'
|
# '"upstream_time": "$upstream_response_time",'
|
||||||
'"upstream_response_time":"$upstream_response_time",'
|
# '"timestamp":"$time_iso8601",'
|
||||||
'"referer":"$http_referer",'
|
# '"ip":"$http_x_forwarded_for"'
|
||||||
'"user_agent":"$http_user_agent",'
|
# '}';
|
||||||
'"x_forwarded_for":"$http_x_forwarded_for",'
|
log_format VCOMBINED '$host:$server_port '
|
||||||
'"host":"$host"'
|
'$remote_addr $remote_user [$time_local] '
|
||||||
'}';
|
'"$request" $status $body_bytes_sent '
|
||||||
|
'"$http_referer" "$http_user_agent"';
|
||||||
|
|
||||||
|
|
||||||
access_log /var/log/nginx/access.log json_log;
|
access_log /var/log/nginx/access.log VCOMBINED;
|
||||||
error_log /var/log/nginx/error.log;
|
error_log /var/log/nginx/error.log debug;
|
||||||
|
|
||||||
sendfile on;
|
sendfile on;
|
||||||
tcp_nopush on;
|
tcp_nopush on;
|
||||||
@@ -93,34 +94,4 @@ http {
|
|||||||
|
|
||||||
# Include all server configurations
|
# Include all server configurations
|
||||||
include /etc/nginx/conf.d/*.conf;
|
include /etc/nginx/conf.d/*.conf;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Existing http {} block stays as-is...
|
|
||||||
|
|
||||||
# TCP stream proxy for SMTP ports
|
|
||||||
# stream {
|
|
||||||
|
|
||||||
# upstream mailserver_smtp {
|
|
||||||
# server mailserver:25; # docker-mailserver container name
|
|
||||||
# }
|
|
||||||
|
|
||||||
# upstream mailserver_submission {
|
|
||||||
# server mailserver:587;
|
|
||||||
# }
|
|
||||||
|
|
||||||
# # Port 25 — inbound MTA-to-MTA (if you ever receive external mail)
|
|
||||||
# server {
|
|
||||||
# listen 25;
|
|
||||||
# proxy_pass mailserver_smtp;
|
|
||||||
# proxy_timeout 1m;
|
|
||||||
# proxy_connect_timeout 10s;
|
|
||||||
# }
|
|
||||||
|
|
||||||
# # Port 587 — STARTTLS submission (for mail clients or apps)
|
|
||||||
# server {
|
|
||||||
# listen 587;
|
|
||||||
# proxy_pass mailserver_submission;
|
|
||||||
# proxy_timeout 1m;
|
|
||||||
# proxy_connect_timeout 10s;
|
|
||||||
# }
|
|
||||||
# }
|
|
||||||
Reference in New Issue
Block a user