A collection of extra variables for NGINX. Used to meet logging or other needs.
Original request path (without arguments).
Original request arguments.
“?” if original request uri has arguments, or an empty string otherwise.
"&" if original request uri has arguments, or "?" otherwise.
Full current uri (with arguments), normalized.
The value of $current_uri may change during request processing, e.g. when doing internal redirects, or when using index files.
Current path (without arguments), normalized.
The value of $current_path is the same as $uri. it may change during request processing, e.g. when doing internal redirects, or when using index files.
Full current uri in request (with arguments), normalized and escaped again.
The value of $escaped_current_uri may change during request processing, e.g. when doing internal redirects, or when using index files.
Current path in request (without arguments), normalized and escaped again.
The value of $normalized_current_uri_path may change during request processing, e.g. when doing internal redirects, or when using index files.
"&" if a request line has arguments, or "?" otherwise.
A literal dollar sign.
Current time in seconds.
The extension from $uri.
"1" if the current request is an "internal request", i.e., a request initiated from inside the current Nginx server instead of from the client side, or "0" otherwise.
"1" if the current request is an Nginx subrequest, or "0" otherwise.
The name of the current location block.
The number of times the current request has been internally.
The number of subrequests performed for this request.
Connection established timestamp in seconds with the milliseconds resolution.
Request created timestamp in seconds with the milliseconds resolution.
Response header sent timestamp in seconds with the milliseconds resolution.
Keeps time spent on handling request internally from receiving the request to sending the response header to the client.
Keeps time spent on sending the response body to the client.
Uppercase host name.
Lowercase host name.
Local time in the rfc 1123 standard format. the time format is consistent with the http Date
header.
The number of packets in the current connection that contained data being retransmitted counted across the lifetime of the connection.
The number of bytes the TCP stack believes can be transmitted in one IP packet without fragmentation to the client. This value is derived on a per-path basis and may be cached between different connections that share the same path.
The maximum number of bytes currently advertised as the TCP receive window (RWIN) to the client. The actual RWIN is reduced by the amount of data currently buffered in the kernel.
The TCP stack's current sending slow start threshold expressed in packets. When the congestion window (CWND) is below this value, the TCP stack will grow its sending rate more aggressively.
The number of bytes advertised in the maximum segment size (MSS) option to the client during connection establishment and therefore the maximum packet size that will be received from the client. It is based on the TCP stack's cached information about the path being used to connect to the client and which sizes have been successfully used on the path in the past.
The TCP stack's measure of the frequency of packet reordering experienced on the path to the client. Connections with a higher than default value of tcpi_reordering are on paths that have exhibited unusual levels of packet reordering in the past. The higher reordering threshold will mitigate spurious TCP retransmissions at the cost of slower recovery to real packet loss. The default value of this variable is 3.
When the TCP stack receives new acknowledgment packets that continue to acknowledge the same sequence number, these are considered duplicate acknowledgments. Duplicate acknowledgments tell the TCP stack that some data continues to arrive at the peer, but the next expected packet in the flow has not yet arrived (e.g., there is a hole) when the acknowledgment was generated. The sender needs to decide whether a packet loss created the hole, signaling the need for data retransmission, or the outstanding packets were just reordered on the way to the peer. The value of tcpi_reordering is the number of consecutive duplicate acknowledgments that trigger the loss logic and initiate the retransmission without waiting for a timer (a.k.a., fast retransmit).
The value of the reordering variable may be altered on a per-path basis via the kernel based on runtime feedback after retransmission when those retransmissions are later determined to have been superfluous. When this happens, the kernel can dynamically raise the reordering threshold which makes it more conservative in determining when to send retransmissions in the future. The new threshold applies to the path and is cached so that it also applies to new connections.
An estimate of time, in microseconds, that it would take the remote client to exhaust the currently advertised remote receive window (RWIN) if no userspace consumption of that data occurred. It is based on the observed bandwidth of the connection and the variable may return zero if there is not enough data transfer yet to make an estimate.
Applications may use this information to schedule the frequency at which they read data from the kernel, but it is primarily used by the kernel itself when determining the size of RWIN.
The number of milliseconds between now and the last time data was transmitted to the client on the current connection. Both new data and retransmitted data are counted. This includes any data framed by the TCP layer such as TLS, HTTP framing, or HTTP message bodies, but it does not include TCP packets that carry only meta information (e.g., pure ACK packets).
Upstream method, usually “GET” or “POST”.
Upstream scheme, "http" or "https".
Full upstream request uri.
Keeps the IP address and port, or the path to the UNIX-domain socket of the latest upstream server.
Keeps status code of the response obtained from the latest upstream server.
Keeps timestamp of upstream starts; the time is kept in seconds with millisecond resolution. Times of several responses are separated by commas and colons like addresses in the $upstream_addr variable.
Keeps timestamp of latest upstream starts; the time is kept in seconds with millisecond resolution.
Keeps timestamp of upstream ssl handshake starts; the time is kept in seconds with millisecond resolution. Times of several responses are separated by commas and colons like addresses in the $upstream_addr variable.
Keeps timestamp of latest upstream ssl handshake starts; the time is kept in seconds with millisecond resolution.
Keeps timestamp of upstream request send starts; the time is kept in seconds with millisecond resolution. Times of several responses are separated by commas and colons like addresses in the $upstream_addr variable.
Keeps timestamp of latest upstream request send starts; the time is kept in seconds with millisecond resolution.
Keeps timestamp of upstream request send ends; the time is kept in seconds with millisecond resolution. Times of several responses are separated by commas and colons like addresses in the $upstream_addr variable.
Keeps timestamp of latest upstream request send ends; the time is kept in seconds with millisecond resolution.
Keeps timestamp of upstream response header sent; the time is kept in seconds with millisecond resolution. Times of several responses are separated by commas and colons like addresses in the $upstream_addr variable.
Keeps timestamp of latest upstream response header sent; the time is kept in seconds with millisecond resolution.
Keeps timestamp of upstream response sent or abnormal interruption; the time is kept in seconds with millisecond resolution. Times of several responses are separated by commas and colons like addresses in the $upstream_addr variable.
Keeps timestamp of latest upstream response sent or abnormal interruption; the time is kept in seconds with millisecond resolution.
Keeps time spent on establishing a connection with the upstream server; the time is kept in seconds with millisecond resolution. In case of SSL, includes time spent on handshake.
Keeps time spent on establishing a connection with the upstream server; the time is kept in seconds with millisecond resolution. In case of SSL, does not include time spent on handshake. Times of several connections are separated by commas and colons like addresses in the $upstream_addr variable.
Keeps time spent on establishing a connection with the upstream server; the time is kept in seconds with millisecond resolution. In case of SSL, does not include time spent on handshake.
Keeps time spent on upstream ssl handshake; the time is kept in seconds with millisecond resolution. Note that this timing starts only after receiving the upstream request header. Times of several ssl connections are separated by commas and colons like addresses in the $upstream_addr variable.
Keeps time spent on latest upstream ssl handshake; the time is kept in seconds with millisecond resolution. Note that this timing starts only after receiving the upstream request header.
Keeps time spent on sending request to the upstream server; the time is kept in seconds with millisecond resolution. Times of several send requests are separated by commas and colons like addresses in the $upstream_addr variable.
Keeps time spent on sending request to the latest upstream server; the time is kept in seconds with millisecond resolution.
Keeps time spent on reading response from the upstream server; the time is kept in seconds with millisecond resolution. Note that this timing starts only after receiving the upstream request header. Times of several responses are separated by commas and colons like addresses in the $upstream_addr variable.
Keeps time spent on reading response from the latest upstream server; the time is kept in seconds with millisecond resolution. Note that this timing starts only after receiving the upstream request header.
Keeps time spent on receiving the response header from the latest upstream server; the time is kept in seconds with millisecond resolution.
Keeps time spent on receiving the response from the latest upstream server; the time is kept in seconds with millisecond resolution.
Keeps the length of the response obtained from the upstream server; the length is kept in bytes.
Number of bytes received from an upstream server.
Number of bytes sent to an upstream server.
"1" if the upstream request is cacheable, or "0" otherwise. it will be empty when the upstream request has not yet been established, do not use it in the early phase of the request (such as the rewrite or access phase).
The cache key being used.
The crc32 checksum of cache key.
The md5sum hash of cache key.
The md5sum hash of main cache key.
The md5sum hash of variant cache key when a request is cached based on the Vary response header.
The file path of upstream cache.
Age of the cache item.
Cache create time. unix time.
Cache create time. the time format is consistent with the http Date
header.
Cache expire time. unix time.
Cache expire time. the time format is consistent with the http Date
header.
Cache ttl.
Cache max age.
The following is some timestamp calculation logic. The variables calculated using $msec have accurate values only when used in the access logs. Their values may not be accurate if used outside the log phase.
-
$connection_time = $msec - $connection_established_ts (connections may be reused)
-
$request_handling_time = $response_header_sent_ts - $request_created_ts
-
$response_body_time = $msec - $response_header_sent_ts
-
$request_time = $msec - $request_created_ts
-
$upstream_last_transport_connect_time = $upstream_last_ssl_start_ts - $upstream_last_start_ts (with ssl)
-
$upstream_last_transport_connect_time = $upstream_last_send_start_ts - $upstream_last_start_ts (without ssl)
-
$upstream_last_ssl_time = $upstream_last_send_start_ts - $upstream_last_ssl_start_ts
-
$upstream_last_send_time = $upstream_last_send_end_ts - $upstream_last_send_start_ts
-
$upstream_last_read_time = $upstream_last_end_ts - $upstream_last_header_ts
-
$upstream_last_header_time = $upstream_last_header_ts - $upstream_last_start_ts
-
$upstream_last_response_time = $upstream_last_end_ts - $upstream_last_start_ts
Jonathan Kolb Hanada [email protected]
This Nginx module is licensed under BSD 2-Clause License.