access-logs.md (traefik-v2.3.2.src) | : | access-logs.md (traefik-v2.3.3.src) | ||
---|---|---|---|---|
skipping to change at line 77 | skipping to change at line 77 | |||
### Filtering | ### Filtering | |||
To filter logs, you can specify a set of filters which are logically "OR-connect ed". | To filter logs, you can specify a set of filters which are logically "OR-connect ed". | |||
Thus, specifying multiple filters will keep more access logs than specifying onl y one. | Thus, specifying multiple filters will keep more access logs than specifying onl y one. | |||
The available filters are: | The available filters are: | |||
- `statusCodes`, to limit the access logs to requests with a status codes in the specified range | - `statusCodes`, to limit the access logs to requests with a status codes in the specified range | |||
- `retryAttempts`, to keep the access logs when at least one retry has happened | - `retryAttempts`, to keep the access logs when at least one retry has happened | |||
- `minDuration`, to keep access logs when requests take longer than the specifie d duration | - `minDuration`, to keep access logs when requests take longer than the specifie d duration (provided in seconds or as a valid duration format, see [time.ParseDu ration](https://golang.org/pkg/time/#ParseDuration)) | |||
```toml tab="File (TOML)" | ```toml tab="File (TOML)" | |||
# Configuring Multiple Filters | # Configuring Multiple Filters | |||
[accessLog] | [accessLog] | |||
filePath = "/path/to/access.log" | filePath = "/path/to/access.log" | |||
format = "json" | format = "json" | |||
[accessLog.filters] | [accessLog.filters] | |||
statusCodes = ["200", "300-302"] | statusCodes = ["200", "300-302"] | |||
retryAttempts = true | retryAttempts = true | |||
skipping to change at line 201 | skipping to change at line 201 | |||
| `ClientUsername` | The username provided in the URL, if present. | | | `ClientUsername` | The username provided in the URL, if present. | | |||
| `RequestAddr` | The HTTP Host header (usually IP:port). This is treated as not a header by the Go API. | | | `RequestAddr` | The HTTP Host header (usually IP:port). This is treated as not a header by the Go API. | | |||
| `RequestHost` | The HTTP Host server name (not including port). | | | `RequestHost` | The HTTP Host server name (not including port). | | |||
| `RequestPort` | The TCP port from the HTTP Host. | | | `RequestPort` | The TCP port from the HTTP Host. | | |||
| `RequestMethod` | The HTTP method. | | | `RequestMethod` | The HTTP method. | | |||
| `RequestPath` | The HTTP request URI, not including the scheme, host or port. | | | `RequestPath` | The HTTP request URI, not including the scheme, host or port. | | |||
| `RequestProtocol` | The version of HTTP requested. | | | `RequestProtocol` | The version of HTTP requested. | | |||
| `RequestScheme` | The HTTP scheme requested `http` or `https`. | | | `RequestScheme` | The HTTP scheme requested `http` or `https`. | | |||
| `RequestLine` | `RequestMethod` + `RequestPath` + `RequestProtoc ol` | | | `RequestLine` | `RequestMethod` + `RequestPath` + `RequestProtoc ol` | | |||
| `RequestContentSize` | The number of bytes in the request entity (a.k.a . body) sent by the client. | | | `RequestContentSize` | The number of bytes in the request entity (a.k.a . body) sent by the client. | | |||
| `OriginDuration` | The time taken by the origin server ('upstream') to return its response. | | | `OriginDuration` | The time taken (in nanoseconds) by the origin se rver ('upstream') to return its response. | | |||
| `OriginContentSize` | The content length specified by the origin serve r, or 0 if unspecified. | | | `OriginContentSize` | The content length specified by the origin serve r, or 0 if unspecified. | | |||
| `OriginStatus` | The HTTP status code returned by the origin serv er. If the request was handled by this Traefik instance (e.g. with a redirect), then this value will be absent. | | | `OriginStatus` | The HTTP status code returned by the origin serv er. If the request was handled by this Traefik instance (e.g. with a redirect), then this value will be absent. | | |||
| `OriginStatusLine` | `OriginStatus` + Status code explanation | | | `OriginStatusLine` | `OriginStatus` + Status code explanation | | |||
| `DownstreamStatus` | The HTTP status code returned to the client. | | | `DownstreamStatus` | The HTTP status code returned to the client. | | |||
| `DownstreamStatusLine` | `DownstreamStatus` + Status code explanation | | | `DownstreamStatusLine` | `DownstreamStatus` + Status code explanation | | |||
| `DownstreamContentSize` | The number of bytes in the response entity retur ned to the client. This is in addition to the "Content-Length" header, which may be present in the origin response. | | | `DownstreamContentSize` | The number of bytes in the response entity retur ned to the client. This is in addition to the "Content-Length" header, which may be present in the origin response. | | |||
| `RequestCount` | The number of requests received since the Traefi k instance started. | | | `RequestCount` | The number of requests received since the Traefi k instance started. | | |||
| `GzipRatio` | The response body compression ratio achieved. | | | `GzipRatio` | The response body compression ratio achieved. | | |||
| `Overhead` | The processing time overhead caused by Traefik. | | | `Overhead` | The processing time overhead (in nanoseconds) ca used by Traefik. | | |||
| `RetryAttempts` | The amount of attempts the request was retried. | | | `RetryAttempts` | The amount of attempts the request was retried. | | |||
## Log Rotation | ## Log Rotation | |||
Traefik will close and reopen its log files, assuming they're configured, on rec eipt of a USR1 signal. | Traefik will close and reopen its log files, assuming they're configured, on rec eipt of a USR1 signal. | |||
This allows the logs to be rotated and processed by an external program, such as `logrotate`. | This allows the logs to be rotated and processed by an external program, such as `logrotate`. | |||
!!! warning | !!! warning | |||
This does not work on Windows due to the lack of USR signals. | This does not work on Windows due to the lack of USR signals. | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added |