apache log json code example
Example 1: apache log format json
log_format le_json '{ "time": "$time_iso8601", ' '"remote_addr": "$remote_addr", ' '"remote_user": "$remote_user", ' '"body_bytes_sent": "$body_bytes_sent", ' '"request_time": "$request_time", ' '"status": "$status", ' '"request": "$request", ' '"request_method": "$request_method", ' '"http_referrer": "$http_referer", ' '"http_user_agent": "$http_user_agent" }'; access_log /var/log/nginx/access.log le_json;
Example 2: apache log format json
"time": "2014-08-11T11:40:13+00:00", "remote_addr": "122.226.223.69", "remote_user": "-", "body_bytes_sent": "579", "request_time": "0.000", "status": "404", "request": "GET http://www.k2proxy.com//hello.html HTTP/1.1", "request_method": "GET", "http_referrer": "-", "http_user_agent": "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/6.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E)"