Skip to content

Commit a2bacd2

Browse files
Make Nginx Logs Format Configurable
- Defaults to JSON in Production and Combined in Dev
1 parent a695ef7 commit a2bacd2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docker/nginx/conf.d/json-logs.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# logging
2-
log_format json_combined escape=json '{"@timestamp":"$time_iso8601","request_time":"$request_time","method":"$request_method","status":"$status","path":"$request_uri","request_query":"$args","vhost":"$host","bytes_sent":"$bytes_sent","request_length":"$request_length","request_proto":"$server_protocol","remote_user":"$remote_user","remote_addr":"$remote_addr","http_referrer":"$http_referer","http_user_agent":"$http_user_agent"}';
3-
access_log /dev/stdout json_combined;
2+
log_format json escape=json '{"@timestamp":"$time_iso8601","status":"$status","method":"$request_method","path":"$request_uri","request_query":"$args","request_time":"$request_time","vhost":"$host","bytes_sent":"$bytes_sent","request_length":"$request_length","request_proto":"$server_protocol","remote_user":"$remote_user","remote_addr":"$remote_addr","http_referrer":"$http_referer","http_user_agent":"$http_user_agent"}';
3+
access_log /dev/stdout ${NGINX_LOG_FORMAT}
44
error_log /dev/stderr warn;

0 commit comments

Comments
 (0)