Skip to content

Commit

Permalink
feat: extend logging for monitoring by OPS (#1685)
Browse files Browse the repository at this point in the history
* Added missing information in log (host, request_time and upstream_response_length)
* an extension to PR #1086
*  Add missing information to main
* Adjust log format json
  • Loading branch information
talpermann2 authored Jun 17, 2024
1 parent 8f54916 commit 480447a
Showing 1 changed file with 29 additions and 32 deletions.
61 changes: 29 additions & 32 deletions nginx/nginx.conf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -21,51 +21,48 @@ http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format json escape=json '{'
'"time_local": "$time_local", '
'"core":'
'"date_access": "$time_iso8601",'
'"http":'
'{'
'"remote_addr": "$remote_addr", '
'"remote_user": "$remote_user", '
'"request": "$request", '
'"status": "$status", '
'"body_bytes_sent": "$body_bytes_sent", '
'"http_referer": "$http_referer", '
'"http_user_agent": "$http_user_agent" ,'
'"http_x_forwarded_for": "$http_x_forwarded_for", '
'"request_method": "$request_method", '
'"request_time": "$request_time", '
'"host": "$host", '
'"server_name": "$server_name"'
'"ident": "$remote_user",'
'"status_code": $status,'
'"referer": "$http_referer",'
'"useragent": "$http_user_agent",'
'"x_forward_for": "$http_x_forwarded_for"'
'"method": "$request_method",'
'"request_time": $request_time,'
'"host": "$http_host",'
'"uri": "$uri",'
'"request_id": "$request_id",'
'"request_length": $request_length,'
'"request_method": "$request_method",'
'"protocol": "$server_protocol",'
'},'
'"ssl":'
'"ingress":'
'{'
'"ssl_cipher": "$ssl_cipher",'
'"ssl_client_cert": "$ssl_client_cert",'
'"ssl_client_fingerprint": "$ssl_client_fingerprint",'
'"ssl_client_i_dn": "$ssl_client_i_dn",'
'"ssl_client_raw_cert": "$ssl_client_raw_cert",'
'"ssl_client_s_dn": "$ssl_client_s_dn",'
'"ssl_client_serial": "$ssl_client_serial",'
'"ssl_client_verify": "$ssl_client_verify",'
'"ssl_protocol": "$ssl_protocol",'
'"ssl_server_name": "$ssl_server_name",'
'"ssl_session_id": "$ssl_session_id",'
'"ssl_session_reused": "$ssl_session_reused"'
'"name": "$ingress_name",'
'"namespace": "$namespace"'
'},'
'"network":'
'{'
'"bytes_written": $body_bytes_sent,'
'"remote_ip": "$remote_addr"'
'},'
'"upstream":'
'{'
'"address": "$upstream_addr", '
'"status": "$upstream_status", '
'"response_time": "$upstream_response_time", '
'"response_length": "$upstream_response_length", '
'"address_list": "$upstream_addr",'
'"status_code": "$upstream_status",'
'"name": "$proxy_upstream_name",'
'"response_time": "$upstream_response_time",'
'"response_length": "$upstream_response_length",'
'"cache_status": "$cache_status"'
'}'
'}';

log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" '
'$upstream_response_time "$cache_status"';
'$upstream_response_time "$cache_status" "$host" "$upstream_response_length" $request_time';

sendfile on;

Expand Down

0 comments on commit 480447a

Please sign in to comment.