2022-04-15 13:44:08 +00:00
---
title: "Traefik Logs Documentation"
description: "Logs are a key part of observability in Traefik Proxy. Read the technical documentation to learn their configurations, rotations, and time zones."
---
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
```yaml tab="File (YAML)"
# Writing Logs to a File
log:
filePath: "/path/to/traefik.log"
```
2021-06-18 22:08:08 +00:00
```toml tab="File (TOML)"
# 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
2021-06-18 22:08:08 +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
```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
```
2021-06-18 22:08:08 +00:00
```toml tab="File (TOML)"
# 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`
2023-03-20 17:56:06 +00:00
By default, the `level` is set to `ERROR` .
2023-03-21 11:00:46 +00:00
Alternative logging levels are `TRACE` , `DEBUG` , `INFO` , `WARN` , `ERROR` , `FATAL` , and `PANIC` .
2019-02-26 13:50:07 +00:00
2019-07-22 07:58:04 +00:00
```yaml tab="File (YAML)"
log:
level: DEBUG
```
2021-06-18 22:08:08 +00:00
```toml tab="File (TOML)"
[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
2022-11-21 17:36:05 +00:00
#### `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
```
2019-02-26 13:50:07 +00:00
## Log Rotation
2022-11-21 17:36:05 +00:00
The rotation of the log files can be configured with the following options.
### `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:
2024-05-13 13:44:03 +00:00
compress: true
2022-11-21 17:36:05 +00:00
```
```toml tab="File (TOML)"
[log]
2024-05-13 13:44:03 +00:00
compress = true
2022-11-21 17:36:05 +00:00
```
2019-02-26 13:50:07 +00:00
2022-11-21 17:36:05 +00:00
```bash tab="CLI"
2024-05-13 13:44:03 +00:00
--log.compress=true
2022-11-21 17:36:05 +00:00
```