Sign inSign up

costa3smoney/nginx-js-logs

By costa3smoney

•Updated over 3 years ago

nginx with comlete logggin including njs logging enabled

Image
0

272

costa3smoney/nginx-js-logs repository overview

Add '"request headers":{$headers_json}}' to add headers to log

Just add your nginx.conf file to /etc/nginx/conf.d/xxx.conf

add log format at the top of your configuration file:

log_format 3smoney '$time_iso8601 site="$server_name" server="$host" dest_port="$server_port" dest_ip="$server_addr" ' 'src="$remote_addr" src_ip="$realip_remote_addr" user="$remote_user" ' 'time_local="$time_local" protocol="$server_protocol" status="$status" ' 'bytes_out="$bytes_sent" bytes_in="$upstream_bytes_received" ' 'http_referer="$http_referer" http_user_agent="$http_user_agent" ' 'nginx_version="$nginx_version" http_x_forwarded_for="$http_x_forwarded_for" ' 'http_x_header="$http_x_header" uri_query="$query_string" uri_path="$uri" ' 'http_method="$request_method" response_time="$upstream_response_time" ' 'cookie="$http_cookie" request_time="$request_time" category="$sent_http_content_type" https="$https"' '"request headers":{$headers_json}}';

and add

access_log /var/log/nginx/access.log 3smoney; error_log /var/log/nginx/error.log info;

Tag summary

Content type

Image

Digest

sha256:8b07917a6…

Size

54.2 MB

Last updated

over 3 years ago

docker pull costa3smoney/nginx-js-logs