Access log variables for OpenResty Edge
HTTP Variables
args: arguments in the request line.realip_remote_addr: keeps the original client address.realip_remote_port: keeps the original client port.binary_remote_addr: client address in a binary form, value’s length is always 4 bytes for IPv4 addresses or 16 bytes for IPv6 addresses.body_bytes_sent: number of bytes sent to a client, not counting the response header.bytes_sent: number of bytes sent to a client.total_bytes: The sum of the bytes of the request body and the response body.connection: connection serial number.connection_requests: current number of requests made through a connection.connections_active: The current number of active client connections includingWaitingconnections.connections_reading: The current number of connections where OpenResty Edge is reading the request header.connections_waiting: The current number of idle client connections waiting for a request.connections_writing: The current number of connections where OpenResty Edge is writing the response back to the client.content_length:Content-Lengthrequest header field.content_type:Content-Typerequest header field.date_gmt: current time in GMT.date_local: current time in the local time zone.document_uri: same as$uri.gzip_ratio: achieved compression ratio, computed as the ratio between the original and compressed response sizes.host: in this order of precedence: host name from the request line, or host name from theHostrequest header field.hostname: host name.http2: negotiated protocol identifier:h2for HTTP/2 over TLS,h2cfor HTTP/2 over cleartext TCP, or an empty string otherwise.https:onif connection operates in SSL mode, or an empty string otherwise.invalid_referer: Empty string, if theRefererrequest header field value is considered valid, otherwise1.is_args:?if a request line has arguments, or an empty string otherwise.limit_rate: Response sending rate limit for this request, in bytes per second;0means unlimited.msec: current time in seconds with the milliseconds resolution.nginx_version: Version of the Nginx core used by the gateway.pid: PID of the worker process.pipe:pif request was pipelined,.otherwise.proxy_add_x_forwarded_for: theX-Forwarded-Forclient request header field with the$remote_addrvariable appended to it, separated by a comma. If theX-Forwarded-Forfield is not present in the client request header, the$proxy_add_x_forwarded_forvariable is equal to the$remote_addrvariable.proxy_host: name and port of a proxied server.proxy_port: port of a proxied server.query_string: same as$args.remote_addr: client address.remote_port: client port.remote_user: user name supplied with the Basic authentication.request: full original request line.request_body: request body.request_body_file: name of a temporary file with the request body.request_completion:OKif a request has completed, or an empty string otherwise.request_id: unique request identifier generated from 16 random bytes, in hexadecimal.request_length: request length (including request line, header, and request body).request_method: request method, usuallyGETorPOST.request_time: request processing time in seconds with a milliseconds resolution (1.3.9, 1.2.6); time elapsed since the first bytes were read from the client.request_uri: full original request URI (with arguments).req_id: unique request identifier.scheme: request scheme,httporhttps.server_addr: an address of the server which accepted a request.server_name: name of the server which accepted a request.server_port: port of the server which accepted a request.server_protocol: request protocol, usuallyHTTP/1.0,HTTP/1.1,HTTP/2.0, orHTTP/3.0.spdy: SPDY protocol version for SPDY connections, or an empty string otherwise.spdy_request_priority: request priority for SPDY connections, or an empty string otherwise.ssl_cipher: returns the name of the cipher used for an established SSL connection.ssl_ciphers: returns the list of ciphers supported by the client. Known ciphers are listed by names, unknown are shown in hexadecimal, for example:.AES128-SHA:AES256-SHA:0x00ffssl_client_cert: returns the client certificate in the PEM format for an established SSL connection, with each line except the first prepended with the tab character.ssl_client_fingerprint: returns the SHA1 fingerprint of the client certificate for an established SSL connection.ssl_client_escaped_cert: returns the client certificate in the PEM format (urlencoded) for an established SSL connection.ssl_client_i_dn: returns theissuer DNstring of the client certificate for an established SSL connection according to RFC 2253.ssl_client_i_dn_legacy: returns theissuer DNstring of the client certificate for an established SSL connection.ssl_client_raw_cert: returns the client certificate in the PEM format for an established SSL connection.ssl_client_s_dn: returns thesubject DNstring of the client certificate for an established SSL connection according to RFC 2253.ssl_client_s_dn_legacy: returns thesubject DNstring of the client certificate for an established SSL connection;.ssl_client_serial: returns the serial number of the client certificate for an established SSL connection;.ssl_client_v_end: returns the end date of the client certificate.ssl_client_v_remain: returns the number of days until the client certificate expires.ssl_client_v_start: returns the start date of the client certificate.ssl_client_verify: returns the result of client certificate verification:SUCCESS,FAILED:reason, andNONEif a certificate was not present.ssl_curves: returns the list of curves supported by the client. Known curves are listed by names, unknown are shown in hexadecimal, for example0x001d:prime256v1:secp521r1:secp384r1.ssl_early_data: returns1if TLS 1.3 early data is used and the handshake is not complete, otherwise empty string.ssl_preread_alpn_protocols: list of protocols advertised by the client through ALPN. The values are separated by commas.ssl_preread_protocol: the highest SSL protocol version supported by the client.ssl_preread_server_name: server name requested through SNI.ssl_protocol: returns the protocol of an established SSL connection.ssl_server_name: returns the server name requested through SNI.ssl_session_id: returns the session identifier of an established SSL connection.ssl_session_reused: returnsrif an SSL session was reused, or.otherwise.status: response status.tcpinfo_rcv_space/tcpinfo_rtt/tcpinfo_rttvar/tcpinfo_snd_cwnd: information about the client TCP connection; available on systems that support the TCP_INFO socket option.time_iso8601: local time in the ISO 8601 standard format.time_local: local time in the Common Log Format.time_local_msec: local time with millisecond precision in common log format.upstream_addr: keeps the IP address and port, or the path to the UNIX-domain socket of the upstream server. If several servers were contacted during request processing, their addresses are separated by commas, e.g.192.168.1.1:80, 192.168.1.2:80, unix:/tmp/sock.upstream_bytes_received: number of bytes received from an upstream server. Values from several connections are separated by commas and colons like addresses in the$upstream_addrvariable.upstream_bytes_sent: number of bytes sent to an upstream server. Values from several connections are separated by commas and colons like addresses in the$upstream_addrvariable.upstream_cache_status: keeps the status of accessing a response cache. The status can be eitherMISS,BYPASS,EXPIRED,STALE,UPDATING,REVALIDATED, orHIT.upstream_connect_time: 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. Times of several connections are separated by commas and colons like addresses in the$upstream_addrvariable.upstream_first_byte_time: time to receive the first byte of data; the time is kept in seconds with millisecond resolution. Times of several connections are separated by commas like addresses in the$upstream_addrvariable.upstream_header_time: keeps time spent on receiving the response header from the upstream server; the time is kept in seconds with millisecond resolution. Times of several responses are separated by commas and colons like addresses in the$upstream_addrvariable.upstream_queue_time: keeps time the request spent in the upstream queue; the time is kept in seconds with millisecond resolution. Times of several responses are separated by commas and colons like addresses in the$upstream_addrvariable.upstream_response_length: keeps the length of the response obtained from the upstream server; the length is kept in bytes. Lengths of several responses are separated by commas and colons like addresses in the$upstream_addrvariable.upstream_response_time: keeps time spent on receiving the response from the upstream server; the time is kept in seconds with millisecond resolution. Times of several responses are separated by commas and colons like addresses in the$upstream_addrvariable.upstream_session_time: session duration in seconds with millisecond resolution. Times of several connections are separated by commas like addresses in the$upstream_addrvariable.upstream_status: keeps status code of the response obtained from the upstream server. Status codes of several responses are separated by commas and colons like addresses in the$upstream_addrvariable. If a server cannot be selected, the variable keeps the 502 (Bad Gateway) status code.upstream_domain: upstream domain selected for the proxy request. The current Admin validator accepts this variable. This variable was first introduced in v26.9.1-1.uri: current URI in request, normalized. The value of$urimay change during request processing, e.g. when doing internal redirects, or when using index files.app_id: The HTTP application ID of OpenResty Edge.internal_request: Whether it is an internal request.limit_status: Traffic limiting result, such asblockordelay; empty when no limiting result was recorded.limit_action: The action taken to limit, such as ‘block’.response_body: The response body.proxy_protocol_addr: client address from the PROXY protocol header.proxy_protocol_port: client port from the PROXY protocol header.client_org: Organization associated with the client IP in the IP database; empty when unavailable. This is a separate field from the autonomous system organization name inclient_aso.client_isp: Client’s Internet Service Provider. This indicates the network service provider used by the visitor, such as Comcast, Verizon, China Telecom, etc. This variable was first introduced in v24.9.1.client_asn: Client’s Autonomous System Number. This is a unique identifier used to identify routing domains on the internet. Each ISP or large network typically has its own ASN. This variable was first introduced in v24.9.1.client_country: Client’s country. This indicates the country corresponding to the visitor’s IP address, such as China, United States, Japan, etc. This variable was first introduced in v24.9.1.client_country_name: country name resolved for the client IP address. The value is a string and is empty when the IP database has no corresponding country name. This variable was first introduced in v26.9.1-1.client_latitude: latitude resolved for the client IP address. The value is emitted as the IP database value and is empty when location data is unavailable. This variable was first introduced in v26.9.1-1.client_longitude: longitude resolved for the client IP address. The value is emitted as the IP database value and is empty when location data is unavailable. This variable was first introduced in v26.9.1-1.client_continent: Client’s continent. This indicates the continent corresponding to the visitor’s IP address, such as Asia, North America, Europe, etc. This variable was first introduced in v24.9.1.client_province: Client’s province or state. This indicates the province (in China) or state (in countries like the United States) corresponding to the visitor’s IP address, such as Guangdong Province, California, etc. This variable was first introduced in v24.9.1.client_city: Client’s city. This indicates the city corresponding to the visitor’s IP address, such as Beijing, New York, Tokyo, etc. This variable was first introduced in v24.9.1.client_aso: Client Autonomous System Organization name. ASO is a unique identifier used to identify internet routing domains, with each ISP or large network operator typically having their own independent ASN/ASO. This variable was first introduced in version v25.6.1.edge_cache_status: Response status of the edge proxy cache, representing the actual cache status seen by the client. Since OpenResty Edge supports cluster caching shared across multiple servers, this status may differ fromupstream_cache_status. This variable was first introduced in version v25.6.1.cluster_hash_cache_status: List of cluster cache response statuses. In OpenResty Edge’s cluster cache architecture, a single request may be processed through multiple Edge Node gateway servers, and this variable records all relevant cache status information. This variable was first introduced in version v25.6.1.edge_upstream_addr: The final upstream server address accessed by the proxy request. In cluster cache scenarios, requests may flow between multiple Edge Nodes without needing to access the actual upstream server. When a request is fully satisfied by cache, this variable’s value will be an empty string. This variable was first introduced in version v25.6.1.cluster_hash_upstream_addr: List of upstream servers in the cluster cache access path. This variable records the complete path of a request within the cluster cache architecture, including all Edge Node gateway servers traversed and the final upstream server addresses. This variable was first introduced in version v25.6.1.
HTTP fixed prefix variables
arg_: argument name in the request line.upstream_trailer_: keeps fields from the end of the response obtained from the upstream server.upstream_http_: keep server response header fields. For example, theServerresponse header field is available through the$upstream_http_servervariable. The rules of converting header field names to variable names are the same as for the variables that start with the$http_prefix. Only the header fields from the response of the last server are saved.sent_http_: arbitrary response header field; the last part of a variable name is the field name converted to lower case with dashes replaced by underscores.sent_trailer_: arbitrary field sent at the end of the response; the last part of a variable name is the field name converted to lower case with dashes replaced by underscores.cookie_: the name cookie.http_: arbitrary request header field; the last part of a variable name is the field name converted to lower case with dashes replaced by underscores.upstream_cookie_: cookie with the specified name sent by the upstream server in theSet-Cookieresponse header field. Only the cookies from the response of the last server are saved.or-global-: global variable of OpenResty Edge.
Stream Variables
Variable availability depends on the gateway version. TLS handshake variables describe connections where the gateway terminates TLS; use ssl_preread_ variables for TLS passthrough. PROXY protocol variables describe received headers, independently of sending PROXY protocol headers upstream.
access_log_type: Access log record type. With segmented logging,intervalis the delta for a period,finalis the remaining delta at connection close, andsession_totalis the cumulative record for the connection. Without segmented logging, the ordinary record at connection close also usessession_total.app_id: ID of the current Stream application.binary_remote_addr: client address in a binary form, value’s length is always 4 bytes for IPv4 addresses or 16 bytes for IPv6 addresses.bytes_received: Bytes received from the client.bytes_sent: number of bytes sent to a client.connection: connection serial number.hostname: host name.msec: current time in seconds with the milliseconds resolution.nginx_version: Version of the Nginx core used by the gateway.pid: PID of the worker process.protocol: Transport protocol:TCPorUDP.proxy_protocol_addr: client address from the PROXY protocol header.proxy_protocol_port: client port from the PROXY protocol header.proxy_protocol_server_addr: server address from the PROXY protocol header.proxy_protocol_server_port: server port from the PROXY protocol header.proxy_protocol_tlv_: Prefix for PROXY v2 TLV fields, for example$proxy_protocol_tlv_alpnor$proxy_protocol_tlv_0x01. Requires incoming PROXY protocol support; unset when the TLV is absent.remote_addr: client address.remote_port: client port.server_addr: an address of the server which accepted a connection.server_name: Name of the virtual server accepting the connection; it need not equal the client’s SNI.server_port: port of the server which accepted a connection.session_time: Session duration in seconds with millisecond precision. With segmented logging,intervalandfinalcontain segment durations, whilesession_totalcontains the cumulative duration.ssl_alpn_protocol: ALPN protocol negotiated during the TLS handshake; empty if none was negotiated.ssl_cipher: returns the name of the cipher used for an established SSL connection.ssl_ciphers: returns the list of ciphers supported by the client. Known ciphers are listed by names, unknown are shown in hexadecimal, for example:.AES128-SHA:AES256-SHA:0x00ffssl_client_cert: returns the client certificate in the PEM format for an established SSL connection, with each line except the first prepended with the tab character.ssl_client_escaped_cert: Client certificate in PEM form, URL-encoded.ssl_client_fingerprint: returns the SHA1 fingerprint of the client certificate for an established SSL connection.ssl_client_i_dn: returns theissuer DNstring of the client certificate for an established SSL connection according to RFC 2253.ssl_client_raw_cert: returns the client certificate in the PEM format for an established SSL connection.ssl_client_s_dn: returns thesubject DNstring of the client certificate for an established SSL connection according to RFC 2253.ssl_client_serial: returns the serial number of the client certificate for an established SSL connection.ssl_client_v_end: returns the end date of the client certificate.ssl_client_v_remain: returns the number of days until the client certificate expires.ssl_client_v_start: returns the start date of the client certificate.ssl_client_verify: returns the result of client certificate verification:SUCCESS,FAILED:reason, andNONEif a certificate was not present.ssl_curve: Curve negotiated for TLS key exchange; empty if the gateway’s TLS implementation cannot provide it.ssl_curves: returns the list of curves supported by the client. Known curves are listed by names, unknown are shown in hexadecimal, for example:0x001d:prime256v1:secp521r1:secp384r1.0x001d:prime256v1:secp521r1:secp384r1ssl_preread_alpn_protocols: Comma-separated ALPN protocols advertised in ClientHello; requires TLS prereading.ssl_preread_protocol: Highest TLS version advertised in ClientHello; requires TLS prereading.ssl_preread_server_name: SNI server name from ClientHello; requires TLS prereading.ssl_protocol: returns the protocol of an established SSL connection.ssl_server_name: returns the server name requested through SNI;.ssl_session_id: returns the session identifier of an established SSL connection.ssl_session_reused: returnsrif an SSL session was reused, or.otherwise.status: Session result, such as200(success),400(bad client data),403(forbidden),500(internal error),502(upstream error), or503(unavailable).time_iso8601: local time in the ISO 8601 standard format.time_local: local time in the Common Log Format.time_local_msec: local time with millisecond precision in common log format.upstream_addr: keeps the IP address and port, or the path to the UNIX-domain socket of the upstream server. If several servers were contacted during request processing, their addresses are separated by commas, e.g.192.168.1.1:80, 192.168.1.2:80, unix:/tmp/sock.upstream_bytes_received: number of bytes received from an upstream server. Values from several connections are separated by commas and colons like addresses in the$upstream_addrvariable.upstream_bytes_sent: number of bytes sent to an upstream server. Values from several connections are separated by commas and colons like addresses in the$upstream_addrvariable.upstream_connect_time: 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. Times of several connections are separated by commas and colons like addresses in the$upstream_addrvariable.upstream_domain: Domain for each upstream connection, with multiple values comma-separated; entries without a domain are empty.upstream_first_byte_time: Time to the first upstream byte, in seconds with millisecond precision; values for multiple upstream connections are comma-separated.upstream_session_time: Duration of each upstream connection, in seconds with millisecond precision; multiple values are comma-separated. Segmentedintervalandfinalrecords contain increments for that segment.
Variables requiring gateway TLS support
These names also require a gateway version that provides them; older gateways may not recognize them. If a variable exists but its TLS functionality is unavailable, its value is empty. Successfully saving a log format does not establish gateway support.
ssl_client_sigalg: Signature algorithm of the TLS client certificate.ssl_sigalg: Server certificate signature algorithm used by the TLS connection; available for new sessions only.ssl_sigalgs: Client-supported signature algorithms, available for new sessions only; names or hexadecimal values depend on the gateway’s TLS support.ssl_ech_status: TLS 1.3 Encrypted ClientHello (ECH) result, such asSUCCESSorNOT_TRIED; empty when ECH reporting is unsupported.ssl_ech_outer_server_name: Public server name from the outer ClientHello when ECH was accepted; otherwise empty.
Socks5 Variables
app_id: ID of the current Socks5 application.time: The local time when the request started.request_id: Request identifier generated by the gateway.request_time: Request processing duration in seconds with millisecond precision.up_bytes: The number of bytes of the request.down_bytes: The number of bytes of the response.proxy_port: The port of the proxy server.client_addr: The address of the client.username: The username.phone: Phone number decoded from AES256 authentication data; empty when not provided.upstream_host: The upstream hostname.upstream_port: The upstream port.status: The status code.bandwidth: The name of the bandwidth rule.failure: The reason for failure.
HTTP Forward Proxy Variables
app_id: ID of the current HTTP forward proxy application.time: The local time when the request started.up_bytes: The number of bytes of the request.down_bytes: The number of bytes of the response.proxy_port: The port of the proxy server.client_addr: The address of the client.upstream_host: The upstream address.upstream_port: The upstream port.method: The request method.status: The status code of the request.failure: The reason for failure.account_key: The account keyword.account: The account.pa_: The information for proxy authentication.header_: The information for the request headers, such as ‘header_host’.arg_: The information for the URI parameters, such as ‘arg_name’.decoded_proxy_authorization: The decoded proxy authorization information.uri: The request path without parameters, e.g.:/geturl: The full request path including parameters, e.g.:http://httpbin.org/get?echo=%E4%BD%A0%E5%A5%BD%EF%BC%8C%E4%B8%96%E7%95%8Crequest_uri: The decoded request path including parameters, e.g.:/get?echo=%E4%BD%A0%E5%A5%BD%EF%BC%8C%E4%B8%96%E7%95%8Cunescape_uri: The raw request path, e.g.:/get?echo=你好,世界
Note that uri, url, request_uri, unescape_uri, arg_, and header_ are only available when the proxied request is an HTTP request. If the proxied request is HTTPS, the communication content is encrypted and these values cannot be retrieved.