Skip to content

Commit

Permalink
feat(gateway): add JSON log format for nginx access logs
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavosbarreto committed Sep 16, 2024
1 parent 2fca08f commit cdf5aec
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions gateway/nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,23 @@ http {
'' '';
}

log_format nginxlog_json escape=json '{ "timestamp": "$time_iso8601", '
'"remote_addr": "$remote_addr", '
'"body_bytes_sent": $body_bytes_sent, '
'"request_time": $request_time, '
'"response_status": $status, '
'"request": "$request", '
'"request_method": "$request_method", '
'"host": "$host",'
'"upstream_addr": "$upstream_addr",'
'"http_x_forwarded_for": "$http_x_forwarded_for",'
'"http_referrer": "$http_referer", '
'"http_user_agent": "$http_user_agent", '
'"http_version": "$server_protocol", '
'"request_id": "$request_id", '
'"nginx_access": true }';

access_log /dev/stdout nginxlog_json;

include /etc/nginx/conf.d/*.conf;
}

0 comments on commit cdf5aec

Please sign in to comment.