Skip to content

Commit

Permalink
Make Nginx Logs Format Configurable
Browse files Browse the repository at this point in the history
- Defaults to JSON in Production and Combined in Dev
  • Loading branch information
sherifabdlnaby committed Dec 7, 2021
1 parent a695ef7 commit a2bacd2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docker/nginx/conf.d/json-logs.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# logging
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"}';
access_log /dev/stdout json_combined;
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"}';
access_log /dev/stdout ${NGINX_LOG_FORMAT}
error_log /dev/stderr warn;

0 comments on commit a2bacd2

Please sign in to comment.