Back to Ingress Nginx

Log format

docs/user-guide/nginx-configuration/log-format.md

latest2.5 KB
Original Source

Log format

The default configuration uses a custom logging format to add additional information about upstreams, response time and status.

log_format upstreaminfo
    '$remote_addr - $remote_user [$time_local] "$request" '
    '$status $body_bytes_sent "$http_referer" "$http_user_agent" '
    '$request_length $request_time [$proxy_upstream_name] [$proxy_alternative_upstream_name] $upstream_addr '
    '$upstream_response_length $upstream_response_time $upstream_status $req_id';
PlaceholderDescription
$proxy_protocol_addrremote address if proxy protocol is enabled
$remote_addrthe source IP address of the client
$remote_useruser name supplied with the Basic authentication
$time_locallocal time in the Common Log Format
$requestfull original request line
$statusresponse status
$body_bytes_sentnumber of bytes sent to a client, not counting the response header
$http_referervalue of the Referer header
$http_user_agentvalue of User-Agent header
$request_lengthrequest length (including request line, header, and request body)
$request_timetime elapsed since the first bytes were read from the client
$proxy_upstream_namename of the upstream. The format is upstream-<namespace>-<service name>-<service port>
$proxy_alternative_upstream_namename of the alternative upstream. The format is upstream-<namespace>-<service name>-<service port>
$upstream_addrthe IP address and port (or the path to the domain socket) of the upstream server. If several servers were contacted during request processing, their addresses are separated by commas.
$upstream_response_lengththe length of the response obtained from the upstream server
$upstream_response_timetime spent on receiving the response from the upstream server as seconds with millisecond resolution
$upstream_statusstatus code of the response obtained from the upstream server
$req_idvalue of the X-Request-ID HTTP header. If the header is not set, a randomly generated ID.

Additional available variables:

PlaceholderDescription
$namespacenamespace of the ingress
$ingress_namename of the ingress
$service_namename of the service
$service_portport of the service

Sources: