Skip to content

Instantly share code, notes, and snippets.

@countingtoten
Created February 19, 2020 17:11
Show Gist options
  • Save countingtoten/f58ee5951e845ac9dfbbd96f6e6d96ac to your computer and use it in GitHub Desktop.
Save countingtoten/f58ee5951e845ac9dfbbd96f6e6d96ac to your computer and use it in GitHub Desktop.
Nginx Proxy Log Line
log_format json escape=json '${LOG_PREFIX} {"source": ["nginx","/var/log/nginx/access.log"], '
'"time": "$time_iso8601", '
'"level": "info", '
'"nginx_remote_addr": "$remote_addr", '
'"nginx_remote_port": "$remote_port", '
'"nginx_realip_remote_addr": "$realip_remote_addr", '
'"nginx_realip_remote_port": "$realip_remote_port", '
'"nginx_server_addr": "$server_addr", '
'"nginx_server_port": "$server_port", '
'"nginx_host": "$host", '
'"nginx_app_name": "app-name", '
'"nginx_bytes_sent": "$bytes_sent", '
'"nginx_body_bytes_sent": "$body_bytes_sent", '
'"nginx_content_length": "$content_length", '
'"nginx_content_type": "$content_type", '
'"nginx_connection": "$connection", '
'"nginx_connection_requests": "$connection_requests", '
'"nginx_status": "$status", '
'"nginx_request": "$request", '
'"nginx_request_length": "$request_length", '
'"nginx_request_method": "$request_method", '
'"nginx_request_duration_seconds": "$request_time", '
'"nginx_request_uri": "$request_uri", '
'"nginx_args": "$args", '
'"nginx_scheme": "$scheme", '
'"nginx_server_protocol": "$server_protocol", '
'"nginx_upstream_addr": "$upstream_addr", '
'"nginx_upstream_bytes_received": "$upstream_bytes_received", '
'"nginx_upstream_connect_duration_seconds": "$upstream_connect_time", '
'"nginx_upstream_header_duration_seconds": "$upstream_header_time", '
'"nginx_upstream_response_length": "$upstream_response_length", '
'"nginx_upstream_response_duration_seconds": "$upstream_response_time", '
'"nginx_upstream_status": "$upstream_status", '
'"nginx_http_user_agent": "$http_user_agent", '
'"nginx_http_accept": "$http_accept", '
'"nginx_http_accept_encoding": "$http_accept_encoding", '
'"nginx_http_x_forwarded_for": "$http_x_forwarded_for", '
'"nginx_http_x_forwarded_host": "$http_x_forwarded_host", '
'"nginx_http_x_forwarded_proto": "$http_x_forwarded_proto", '
'"nginx_http_x_request_id": "$http_x_request_id", '
'"nginx_cookie___cfduid": "$cookie___cfduid"}';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment