New logger for the Traefik logs
This commit is contained in:
parent
27c02b5a56
commit
56f7515ecd
297 changed files with 2337 additions and 1934 deletions
|
@ -64,7 +64,7 @@ log:
|
|||
|
||||
#### `level`
|
||||
|
||||
By default, the `level` is set to `ERROR`. Alternative logging levels are `DEBUG`, `PANIC`, `FATAL`, `ERROR`, `WARN`, and `INFO`.
|
||||
By default, the `level` is set to `ERROR`. Alternative logging levels are `TRACE`, `DEBUG`, `PANIC`, `FATAL`, `ERROR`, `WARN`, and `INFO`.
|
||||
|
||||
```yaml tab="File (YAML)"
|
||||
log:
|
||||
|
@ -80,10 +80,101 @@ log:
|
|||
--log.level=DEBUG
|
||||
```
|
||||
|
||||
#### `noColor`
|
||||
|
||||
When using the 'common' format, disables the colorized output.
|
||||
|
||||
```yaml tab="File (YAML)"
|
||||
log:
|
||||
noColor: true
|
||||
```
|
||||
|
||||
```toml tab="File (TOML)"
|
||||
[log]
|
||||
noColor = true
|
||||
```
|
||||
|
||||
```bash tab="CLI"
|
||||
--log.nocolor=true
|
||||
```
|
||||
|
||||
## Log Rotation
|
||||
|
||||
Traefik will close and reopen its log files, assuming they're configured, on receipt of a USR1 signal.
|
||||
This allows the logs to be rotated and processed by an external program, such as `logrotate`.
|
||||
The rotation of the log files can be configured with the following options.
|
||||
|
||||
!!! warning
|
||||
This does not work on Windows due to the lack of USR signals.
|
||||
### `maxSize`
|
||||
|
||||
`maxSize` is the maximum size in megabytes of the log file before it gets rotated.
|
||||
It defaults to 100 megabytes.
|
||||
|
||||
```yaml tab="File (YAML)"
|
||||
log:
|
||||
maxSize: 1
|
||||
```
|
||||
|
||||
```toml tab="File (TOML)"
|
||||
[log]
|
||||
maxSize = 1
|
||||
```
|
||||
|
||||
```bash tab="CLI"
|
||||
--log.maxsize=1
|
||||
```
|
||||
|
||||
### `maxBackups`
|
||||
|
||||
`maxBackups` is the maximum number of old log files to retain.
|
||||
The default is to retain all old log files (though `maxAge` may still cause them to get deleted).
|
||||
|
||||
```yaml tab="File (YAML)"
|
||||
log:
|
||||
maxBackups: 3
|
||||
```
|
||||
|
||||
```toml tab="File (TOML)"
|
||||
[log]
|
||||
maxBackups = 3
|
||||
```
|
||||
|
||||
```bash tab="CLI"
|
||||
--log.maxbackups=3
|
||||
```
|
||||
|
||||
### `maxAge`
|
||||
|
||||
`maxAge` is the maximum number of days to retain old log files based on the timestamp encoded in their filename.
|
||||
Note that a day is defined as 24 hours and may not exactly correspond to calendar days due to daylight savings, leap seconds, etc.
|
||||
The default is not to remove old log files based on age.
|
||||
|
||||
```yaml tab="File (YAML)"
|
||||
log:
|
||||
maxAge: 3
|
||||
```
|
||||
|
||||
```toml tab="File (TOML)"
|
||||
[log]
|
||||
maxAge = 3
|
||||
```
|
||||
|
||||
```bash tab="CLI"
|
||||
--log.maxage=3
|
||||
```
|
||||
|
||||
### `compress`
|
||||
|
||||
`compress` determines if the rotated log files should be compressed using gzip.
|
||||
The default is not to perform compression.
|
||||
|
||||
```yaml tab="File (YAML)"
|
||||
log:
|
||||
compress: 3
|
||||
```
|
||||
|
||||
```toml tab="File (TOML)"
|
||||
[log]
|
||||
compress = 3
|
||||
```
|
||||
|
||||
```bash tab="CLI"
|
||||
--log.compress=3
|
||||
```
|
||||
|
|
|
@ -246,6 +246,9 @@ The TLS key for Traefik Proxy as a TLS client.
|
|||
`--log`:
|
||||
Traefik log settings. (Default: ```false```)
|
||||
|
||||
`--log.compress`:
|
||||
Determines if the rotated log files should be compressed using gzip. (Default: ```false```)
|
||||
|
||||
`--log.filepath`:
|
||||
Traefik log file path. Stdout is used when omitted or empty.
|
||||
|
||||
|
@ -255,6 +258,18 @@ Traefik log format: json | common (Default: ```common```)
|
|||
`--log.level`:
|
||||
Log level set to traefik logs. (Default: ```ERROR```)
|
||||
|
||||
`--log.maxage`:
|
||||
Maximum number of days to retain old log files based on the timestamp encoded in their filename. (Default: ```0```)
|
||||
|
||||
`--log.maxbackups`:
|
||||
Maximum number of old log files to retain. (Default: ```0```)
|
||||
|
||||
`--log.maxsize`:
|
||||
Maximum size in megabytes of the log file before it gets rotated. (Default: ```0```)
|
||||
|
||||
`--log.nocolor`:
|
||||
When using the 'common' format, disables the colorized output. (Default: ```false```)
|
||||
|
||||
`--metrics.datadog`:
|
||||
Datadog metrics exporter type. (Default: ```false```)
|
||||
|
||||
|
|
|
@ -246,6 +246,9 @@ The TLS key for Traefik Proxy as a TLS client.
|
|||
`TRAEFIK_LOG`:
|
||||
Traefik log settings. (Default: ```false```)
|
||||
|
||||
`TRAEFIK_LOG_COMPRESS`:
|
||||
Determines if the rotated log files should be compressed using gzip. (Default: ```false```)
|
||||
|
||||
`TRAEFIK_LOG_FILEPATH`:
|
||||
Traefik log file path. Stdout is used when omitted or empty.
|
||||
|
||||
|
@ -255,6 +258,18 @@ Traefik log format: json | common (Default: ```common```)
|
|||
`TRAEFIK_LOG_LEVEL`:
|
||||
Log level set to traefik logs. (Default: ```ERROR```)
|
||||
|
||||
`TRAEFIK_LOG_MAXAGE`:
|
||||
Maximum number of days to retain old log files based on the timestamp encoded in their filename. (Default: ```0```)
|
||||
|
||||
`TRAEFIK_LOG_MAXBACKUPS`:
|
||||
Maximum number of old log files to retain. (Default: ```0```)
|
||||
|
||||
`TRAEFIK_LOG_MAXSIZE`:
|
||||
Maximum size in megabytes of the log file before it gets rotated. (Default: ```0```)
|
||||
|
||||
`TRAEFIK_LOG_NOCOLOR`:
|
||||
When using the 'common' format, disables the colorized output. (Default: ```false```)
|
||||
|
||||
`TRAEFIK_METRICS_DATADOG`:
|
||||
Datadog metrics exporter type. (Default: ```false```)
|
||||
|
||||
|
|
|
@ -326,8 +326,13 @@
|
|||
|
||||
[log]
|
||||
level = "foobar"
|
||||
filePath = "foobar"
|
||||
format = "foobar"
|
||||
noColor = true
|
||||
filePath = "foobar"
|
||||
maxSize = 42
|
||||
maxBackups = 42
|
||||
maxAge = 42
|
||||
compress = true
|
||||
|
||||
[accessLog]
|
||||
filePath = "foobar"
|
||||
|
|
|
@ -352,8 +352,13 @@ ping:
|
|||
terminatingStatusCode: 42
|
||||
log:
|
||||
level: foobar
|
||||
filePath: foobar
|
||||
format: foobar
|
||||
noColor: true
|
||||
filePath: foobar
|
||||
maxSize: 42
|
||||
maxBackups: 42
|
||||
maxAge: 42
|
||||
compress: true
|
||||
accessLog:
|
||||
filePath: foobar
|
||||
format: foobar
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue