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

48 lines
2.5 KiB
Markdown
Raw Normal View History

2017-10-13 13:55:03 +00:00
# Log format
2018-05-03 07:44:21 +00:00
The default configuration uses a custom logging format to add additional information about upstreams, response time and status.
2017-10-13 13:55:03 +00:00
```
2018-05-03 07:44:21 +00:00
log_format upstreaminfo
2019-09-12 23:01:33 +00:00
'$remote_addr - $remote_user [$time_local] "$request" '
2018-05-03 07:44:21 +00:00
'$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';
2017-10-13 13:55:03 +00:00
```
2018-05-03 07:44:21 +00:00
| Placeholder | Description |
|-------------|-------------|
| `$proxy_protocol_addr` | remote address if proxy protocol is enabled |
2019-09-12 23:01:33 +00:00
| `$remote_addr` | the source IP address of the client |
2018-05-03 07:44:21 +00:00
| `$remote_user` | user name supplied with the Basic authentication |
| `$time_local` | local time in the Common Log Format |
| `$request` | full original request line |
| `$status` | response status |
| `$body_bytes_sent` | number of bytes sent to a client, not counting the response header |
| `$http_referer` | value of the Referer header |
| `$http_user_agent` | value of User-Agent header |
| `$request_length` | request length (including request line, header, and request body) |
| `$request_time` | time elapsed since the first bytes were read from the client |
| `$proxy_upstream_name` | name of the upstream. The format is `upstream-<namespace>-<service name>-<service port>` |
| `$proxy_alternative_upstream_name` | name of the alternative upstream. The format is `upstream-<namespace>-<service name>-<service port>` |
2018-05-03 07:44:21 +00:00
| `$upstream_addr` | the 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_length` | the length of the response obtained from the upstream server |
| `$upstream_response_time` | time spent on receiving the response from the upstream server as seconds with millisecond resolution |
| `$upstream_status` | status code of the response obtained from the upstream server |
| `$req_id` | value of the `X-Request-ID` HTTP header. If the header is not set, a randomly generated ID. |
2017-10-13 13:55:03 +00:00
Additional available variables:
| Placeholder | Description |
|-------------|-------------|
| `$namespace` | namespace of the ingress |
| `$ingress_name` | name of the ingress |
| `$service_name` | name of the service |
| `$service_port` | port of the service |
2017-10-13 13:55:03 +00:00
2018-05-03 07:44:21 +00:00
Sources:
2017-10-13 13:55:03 +00:00
Darwin arm64 (#8399) * Use sed instead of gnu find flags Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * Support building linux/amd64 on darin/arm64 Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * Upgrade awesome_bot to dkhamsing/awesome_bot:1.20.0 Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * Favor find -prune for vendor Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * Skip golang modcache folder Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * Favor find -prune for changelog Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * Ignore Changelogs of any case Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * Fix service-l7 link Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * Fix route53-mapper link Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * Update rootfs contents description The auxiliary scripts were removed after: https://github.com/kubernetes/ingress-nginx/tree/ab8349008a1db07205c4e6a9a80b16caafd272d4/rootfs/ingress-controller Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * Update paths for modsecurity Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * Update paths for modsecurity_snippet Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * Update toc for 20190815-zone-aware-routing.md Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * Use Internet Archive for datapath.io blog entry Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * Use Internet Archive for cloudflare.com help center entry Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * Use https for nginx.org Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
2022-04-06 20:46:26 +00:00
- [Upstream variables](https://nginx.org/en/docs/http/ngx_http_upstream_module.html#variables)
- [Embedded variables](https://nginx.org/en/docs/http/ngx_http_core_module.html#variables)