2019-02-26 13:50:07 +00:00
|
|
|
# Logs
|
|
|
|
|
|
|
|
Reading What's Happening
|
|
|
|
{: .subtitle }
|
|
|
|
|
|
|
|
By default, logs are written to stdout, in text format.
|
|
|
|
|
2019-06-21 08:54:04 +00:00
|
|
|
## Configuration
|
2019-02-26 13:50:07 +00:00
|
|
|
|
|
|
|
### General
|
|
|
|
|
|
|
|
Traefik logs concern everything that happens to Traefik itself (startup, configuration, events, shutdown, and so on).
|
|
|
|
|
2019-06-21 08:54:04 +00:00
|
|
|
#### `filePath`
|
2019-02-26 13:50:07 +00:00
|
|
|
|
|
|
|
By default, the logs are written to the standard output.
|
|
|
|
You can configure a file path instead using the `filePath` option.
|
|
|
|
|
2019-07-22 07:58:04 +00:00
|
|
|
```toml tab="File (TOML)"
|
2019-06-21 08:54:04 +00:00
|
|
|
# Writing Logs to a File
|
|
|
|
[log]
|
|
|
|
filePath = "/path/to/traefik.log"
|
|
|
|
```
|
|
|
|
|
2019-07-22 07:58:04 +00:00
|
|
|
```yaml tab="File (YAML)"
|
|
|
|
# Writing Logs to a File
|
|
|
|
log:
|
|
|
|
filePath: "/path/to/traefik.log"
|
|
|
|
```
|
|
|
|
|
2019-06-21 08:54:04 +00:00
|
|
|
```bash tab="CLI"
|
|
|
|
# Writing Logs to a File
|
2019-11-19 09:18:05 +00:00
|
|
|
--log.filePath=/path/to/traefik.log
|
2019-06-21 08:54:04 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
#### `format`
|
2019-02-26 13:50:07 +00:00
|
|
|
|
|
|
|
By default, the logs use a text format (`common`), but you can also ask for the `json` format in the `format` option.
|
|
|
|
|
2019-07-22 07:58:04 +00:00
|
|
|
```toml tab="File (TOML)"
|
2019-06-21 08:54:04 +00:00
|
|
|
# Writing Logs to a File, in JSON
|
|
|
|
[log]
|
|
|
|
filePath = "/path/to/log-file.log"
|
2019-07-22 07:58:04 +00:00
|
|
|
format = "json"
|
|
|
|
```
|
|
|
|
|
|
|
|
```yaml tab="File (YAML)"
|
|
|
|
# Writing Logs to a File, in JSON
|
|
|
|
log:
|
|
|
|
filePath: "/path/to/log-file.log"
|
|
|
|
format: json
|
2019-06-21 08:54:04 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
```bash tab="CLI"
|
|
|
|
# Writing Logs to a File, in JSON
|
2019-11-19 09:18:05 +00:00
|
|
|
--log.filePath=/path/to/traefik.log
|
|
|
|
--log.format=json
|
2019-06-21 08:54:04 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
#### `level`
|
|
|
|
|
|
|
|
By default, the `level` is set to `ERROR`. Alternative logging levels are `DEBUG`, `PANIC`, `FATAL`, `ERROR`, `WARN`, and `INFO`.
|
|
|
|
|
2019-07-22 07:58:04 +00:00
|
|
|
```toml tab="File (TOML)"
|
2019-06-21 08:54:04 +00:00
|
|
|
[log]
|
|
|
|
level = "DEBUG"
|
|
|
|
```
|
2019-02-26 13:50:07 +00:00
|
|
|
|
2019-07-22 07:58:04 +00:00
|
|
|
```yaml tab="File (YAML)"
|
|
|
|
log:
|
|
|
|
level: DEBUG
|
|
|
|
```
|
|
|
|
|
2019-06-21 08:54:04 +00:00
|
|
|
```bash tab="CLI"
|
2019-11-19 09:18:05 +00:00
|
|
|
--log.level=DEBUG
|
2019-06-21 08:54:04 +00:00
|
|
|
```
|
2019-02-26 13:50:07 +00:00
|
|
|
|
|
|
|
## 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`.
|
|
|
|
|
2019-09-23 12:32:04 +00:00
|
|
|
!!! warning
|
2019-02-26 13:50:07 +00:00
|
|
|
This does not work on Windows due to the lack of USR signals.
|