[] Nginx Nginx configuration Json format of the log

nginx.conf module configuration log_format:

log_format main '{
  "@timestamp":"$time_iso8601",
  "host":"$server_addr",
  "clientip":"$remote_addr",
  "remote_user":"$remote_user",
  "request":"$request",
  "http_user_agent":"$http_user_agent",
  "size":"$body_bytes_sent",
  "responsetime":"$request_time",
  "upstreamtime":"$upstream_response_time",
  "upstreamhost":"$upstream_addr",
  "http_host":"$host",
  "url":"$uri",
  "domain":"$host",
  "xff":"$http_x_forwarded_for",
  "referer":"$http_referer",
  "status":"$status"
}';

 

After the configuration format of the next check: ../ sbin / nginx -t

After the check is successful, reload the configuration: ../ sbin / nginx -s reload

Log shown below:

 

Guess you like

Origin www.cnblogs.com/cnskylee/p/11302219.html