Skip to content

Instantly share code, notes, and snippets.

@Ima8
Forked from iCyLand/w3c.conf
Created July 3, 2018 09:31
Show Gist options
  • Save Ima8/0cbb25013c697ddc085fa3b28358dc8d to your computer and use it in GitHub Desktop.
Save Ima8/0cbb25013c697ddc085fa3b28358dc8d to your computer and use it in GitHub Desktop.

Revisions

  1. @iCyLand iCyLand created this gist Jul 3, 2018.
    28 changes: 28 additions & 0 deletions w3c.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    map $request_uri $request_uri_path {
    "~^(?P<path>[^?]*)(\?.*)?$" $path;
    }

    log_format w3cjson escape=json
    '{'
    '"Date":"$time_iso8601",'
    '"Client IP Address":"$remote_addr",'
    '"Client Username":"$remote_user",'
    '"Server IP Address":"$server_addr",'
    '"Request Port":$server_port,'
    '"Request Protocol":"$server_protocol",'
    '"Request Method":"$request_method",'
    '"Request URI":"$request_uri_path",'
    '"Query String":"$query_string",'
    '"Status":$status,'
    '"User Agent":"$http_user_agent",'
    '"Cookie":"$http_cookie",'
    '"Referer":"$http_referer",'
    '"Bytes Received":$request_length,'
    '"Bytes Sent":$body_bytes_sent,'
    '"Request Time":$request_time,'
    '"X-Forwarded-For":"$http_x_forwarded_for",'
    '"Upstream":"$upstream_addr",'
    '"Upstream Response Time":$upstream_response_time,'
    '"Upstream Cache Status":"$upstream_cache_status",'
    '"Request Country Code","$geoip_country_code"'
    '}';