Skip to content

Commit 4b8d81e

Browse files
authored
nginx logging as json (#1733)
* nginx logging as json * string the values that could be - when empty
1 parent 2ede66f commit 4b8d81e

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

nginx/production.conf

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,12 @@ server {
1111
}
1212
}
1313

14-
log_format latency_log '$http_cf_connecting_ip - [$remote_addr | $time_local] '
15-
'"$request" $status $body_bytes_sent '
16-
'"$http_referer" "$http_user_agent" '
17-
'rt=$request_time '
18-
'urt=$upstream_response_time '
19-
'uht=$upstream_header_time '
20-
'uct=$upstream_connect_time';
14+
log_format latency_log escape=json
15+
'{ "cf_ip":"$http_cf_connecting_ip", "remote":"$remote_addr", '
16+
'"time":"$time_iso8601", "request":"$request", "status":$status, '
17+
'"bytes":$body_bytes_sent, "referer":"$http_referer", "agent":"$http_user_agent", '
18+
'"rt":$request_time, "urt":"$upstream_response_time", '
19+
'"uht":"$upstream_header_time", "uct":"$upstream_connect_time" }';
2120

2221
# {{HTTPS_SERVER_BLOCK_START}}
2322
server {

0 commit comments

Comments
 (0)