Created
May 22, 2019 12:45
-
-
Save relvira/1fbb93d8cf83e84639eef7b658c078ec to your computer and use it in GitHub Desktop.
NGINX JSON log_format
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
log_format main_json escape=json | |
'{' | |
'"@timestamp":"$time_iso8601",' | |
'"cloudflare":{' | |
'"ray_id": "$http_cf_ray",' | |
'"colo": "$cf_colo",' | |
'"connecting_ip": "$http_cf_connecting_ip",' | |
'"device_type": "$http_cf_device_type",' | |
'"ipcountry": "$http_cf_ipcountry"' | |
'},' | |
'"nginx":{' | |
'"connection": $connection,' | |
'"connection_requests": $connection_requests' | |
'},' | |
'"dd":{' | |
'"trace_id":"$upstream_http_x_datadog_trace_id",' | |
'"parent_id":"$upstream_http_x_datadog_parent_id"' | |
'},' | |
'"remote_user":"$remote_user",' | |
'"ssl":{' | |
'"ciphers":"$ssl_ciphers",' | |
'"client_verify":"$ssl_client_verify",' | |
'"protocol":"$ssl_protocol",' | |
'"server_name":"$ssl_server_name",' | |
'"session_reused":"$ssl_session_reused"' | |
'},' | |
'"http":{' | |
'"body_bytes_sent":$body_bytes_sent,' | |
'"content_length":"$content_length",' | |
'"content_type":"$content_type",' | |
'"document_root":"$document_root",' | |
'"headers":{' | |
'"if_none_match":"$http_if_none_match",' | |
'"if_modified_since":"$http_if_modified_since",' | |
'"x_forwarded_for":"$http_x_forwarded_for",' | |
'"x_forwarded_proto":"$http_x_forwarded_proto",' | |
'"x_runtime":"$upstream_http_x_runtime",' | |
'"x_zendesk_origin_server": "$upstream_http_x_zendesk_origin_server"' | |
'},' | |
'"host":"$host",' | |
'"method":"$request_method", ' | |
'"protocol":"$server_protocol",' | |
'"referer":"$http_referer",' | |
'"request":"$request",' | |
'"request_completion":"$request_completion",' | |
'"request_length":$request_length,' | |
'"request_time":$request_time,' | |
'"status_code":$status,' | |
'"request_id":"$uuid",' | |
'"url_details":{' | |
'"path":"$uri",' | |
'"scheme":"$scheme"' | |
'},' | |
'"user_agent":"$http_user_agent"' | |
'},' | |
'"location_upstream":"$service_name",' | |
'"location_name":"$location_name",' | |
'"tcp_conn":{' | |
'"realip_remote_addr":"$realip_remote_addr",' | |
'"realip_remote_port":$realip_remote_port,' | |
'"remote_addr":"$remote_addr",' | |
'"remote_port":"$remote_port",' | |
'"server_name":"$server_name",' | |
'"server_port":$server_port' | |
'},' | |
'"tcp_stats":{' | |
'"rtt":$tcpinfo_rtt,' | |
'"rttvar":$tcpinfo_rttvar,' | |
'"snd_cwnd":$tcpinfo_snd_cwnd,' | |
'"rcv_space":$tcpinfo_rcv_space' | |
'},' | |
'"time_local":"$time_local",' | |
'"upstream":{' | |
'"addr":"$upstream_addr",' | |
'"bytes_received":"$upstream_bytes_received",' | |
'"cache_status":"$upstream_cache_status",' | |
'"connect_time":"$upstream_connect_time",' | |
'"header_time":"$upstream_header_time",' | |
'"headers":{' | |
'"x_accel_redirect":"$upstream_http_x_accel_redirect",' | |
'"if_modified_since":"$upstream_http_if_modified_since",' | |
'"if_none_match":"$upstream_http_if_none_match",' | |
'"location":"$upstream_http_location"' | |
'},' | |
'"response_time":"$upstream_response_time",' | |
'"status":"$upstream_status"' | |
'}' | |
'}'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment