Created
July 18, 2023 23:42
-
-
Save marcus-crane/04c55116275c0a09a96e1ff77749a64d to your computer and use it in GitHub Desktop.
Basic nginx file that contains all possible log parameters in JSON 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
worker_processes 2; | |
user www-data; | |
events { | |
use epoll; | |
worker_connections 128; | |
} | |
error_log /dev/stdout info; | |
http { | |
server_tokens off; | |
include mime.types; | |
charset utf-8; | |
log_format json_combined escape=json | |
'{' | |
'"@timestamp":"$time_iso8601",' | |
'"arg_name":"$arg_name",' | |
'"args":"$args",' | |
'"binary_remote_addr":"$binary_remote_addr",' | |
'"body_bytes_sent":"$body_bytes_sent",' | |
'"bytes_sent":"$bytes_sent",' | |
'"connection":"$connection",' | |
'"connection_requests":"$connection_requests",' | |
'"connection_time":"$connection_time",' | |
'"content_length":"$content_length",' | |
'"content_type":"$content_type",' | |
'"cookie_name":"$cookie_name",' | |
'"document_root":"$document_root",' | |
'"document_uri":"$document_uri",' | |
'"host":"$host",' | |
'"hostname":"$hostname",' | |
'"http_name":"$http_name",' | |
'"https":"$https",' | |
'"is_args":"$is_args",' | |
'"limit_rate":"$limit_rate",' | |
'"msec":"$msec",' | |
'"nginx_version":"$nginx_version",' | |
'"pid":"$pid",' | |
'"pipe":"$pipe",' | |
'"proxy_protocol_addr":"$proxy_protocol_addr",' | |
'"proxy_protocol_port":"$proxy_protocol_port",' | |
'"proxy_protocol_server_addr":"$proxy_protocol_server_addr",' | |
'"proxy_protocol_server_port":"$proxy_protocol_server_port",' | |
'"proxy_protocol_tlv_name":"$proxy_protocol_tlv_name",' | |
'"query_string":"$query_string",' | |
'"realpath_root":"$realpath_root",' | |
'"remote_addr":"$remote_addr",' | |
'"remote_port":"$remote_port",' | |
'"remote_user":"$remote_user",' | |
'"request":"$request",' | |
'"request_body":"$request_body",' | |
'"request_body_file":"$request_body_file",' | |
'"request_completion":"$request_completion",' | |
'"request_filename":"$request_filename",' | |
'"request_id":"$request_id",' | |
'"request_length":"$request_length",' | |
'"request_method":"$request_method",' | |
'"request_time":"$request_time",' | |
'"request_uri":"$request_uri",' | |
'"scheme":"$scheme",' | |
'"sent_http_name":"$sent_http_name",' | |
'"sent_trailer_name":"$sent_trailer_name",' | |
'"server_addr":"$server_addr",' | |
'"server_name":"$server_name",' | |
'"server_port":"$server_port",' | |
'"server_protocol":"$server_protocol",' | |
'"status":"$status",' | |
'"tcpinfo_rtt":"$tcpinfo_rtt",' | |
'"tcpinfo_rttvar":"$tcpinfo_rttvar",' | |
'"tcpinfo_snd_cwnd":"$tcpinfo_snd_cwnd",' | |
'"tcpinfo_rcv_space":"$tcpinfo_rcv_space",' | |
'"time_iso8601":"$time_iso8601",' | |
'"time_local":"$time_local",' | |
'"uri":"$uri",' | |
'}'; | |
access_log /dev/stdout json_combined; | |
server { | |
listen 8999; | |
error_page 500 502 503 504 /50x.html; | |
location / { | |
return 200 'hello world!\n'; | |
} | |
} | |
} |
Author
marcus-crane
commented
Jul 18, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment