Detailed explanation of nginx log format

log_format combined '$remote_addr - $remote_user [$time_local] '
'$request "$status" $body_bytes_sent ''"$http_referer" "$http_user_agent" '

 #默认LOG中有'$remote_addr和$remote_user中间 有-

 #其他自定义的LOG
 log_format main '$remote_addr - $remote_user [$time_local] $request '
 '"$status" $body_bytes_sent "$http_referer" ''"$http_user_agent" "$http_x_forwarded_for"';

 #后端记录真实访问IP
log_format download '$remote_addr - $remote_user [$time_local] '
'"$request" $status $bytes_sent ''"$http_referer" "$http_user_agent" '
'"$http_range" "$sent_http_content_range"';

log_format timelog '$remote_addr - $remote_user [$time_local] $request '
'"$status" $body_bytes_sent "$http_referer" ''"$http_user_agent" "$http_x_forwarded_for"'
'$request_time $upstream_response_time

description
$remote_addr remote address
$remote_user remote user
$time_local local time (server time) written in normal log format
$request request method and connection
$request_length length of request body.
$request_time nginx processing request time, in milliseconds (seconds can be used after version 0.5.19)
$status response status (code)
$upstream_response_time backend processing time, proxy response time
$upstream_status status of backend server
$ upstream_addr : The IP address and port of the backend server
$body_bytes_sent minus the number of bytes sent to the client after the response header, this variable is compatible with the %B parameter of the apache module mod_log_config (this variable was $apache_bytes_sent before 0.3.10).
$bytes_sent The number of bytes sent to the client.
$http_referer The link to jump to $request, from where to access $request
$http_user_agent browser operating system information, etc.
$http_x_forwarded_for Access the IP of the user's real server
$http_range ?
$sent_http_content_range ?
$connection, the number of connections.
$msec, the current time (to the millionth of a second) at which the log entry is being written
$pipe, if the request was piped.
$status $upstream_status : The status code of the response. Front-end server response status, back-end server response status
$request_time $upstream_response_time : A must for performance! Take a look at how long the front end takes to transfer files, and how long it takes for background processing. The former is useful for understanding network status, and the latter is useful for understanding service performance.

$remote_addr $upstream_addr : The IP address of the user, the IP address of the backend service
$bytes_sent $body_bytes_sent : The amount of data sent to the client (including HTTP headers and excluding HTTP headers)
$bytes_sent $body_bytes_sent : The amount of data sent to the client (including HTTP header and does not contain HTTP header)
$host $request : The most important thing is to get the specific URL of the specific domain name, so don't be blind.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324456846&siteId=291194637