Logs¶
Reading What's Happening
By default, logs are written to stdout, in text format.
Configuration¶
General¶
Traefik logs concern everything that happens to Traefik itself (startup, configuration, events, shutdown, and so on).
filePath¶
By default, the logs are written to the standard output.
You can configure a file path instead using the filePath option.
# Writing Logs to a File
log:
filePath: "/path/to/traefik.log"# Writing Logs to a File
[log]
filePath = "/path/to/traefik.log"# Writing Logs to a File
--log.filePath=/path/to/traefik.logformat¶
By default, the logs use a text format (common), but you can also ask for the json format in the format option.
# Writing Logs to a File, in JSON
log:
filePath: "/path/to/log-file.log"
format: json# Writing Logs to a File, in JSON
[log]
filePath = "/path/to/log-file.log"
format = "json"# Writing Logs to a File, in JSON
--log.filePath=/path/to/traefik.log
--log.format=jsonlevel¶
By default, the level is set to ERROR.
Alternative logging levels are TRACE, DEBUG, INFO, WARN, ERROR, FATAL, and PANIC.
log:
level: DEBUG[log]
level = "DEBUG"--log.level=DEBUGnoColor¶
When using the 'common' format, disables the colorized output.
log:
noColor: true[log]
noColor = true--log.nocolor=trueLog Rotation¶
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.
log:
maxSize: 1[log]
maxSize = 1--log.maxsize=1maxBackups¶
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).
log:
maxBackups: 3[log]
maxBackups = 3--log.maxbackups=3maxAge¶
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.
log:
maxAge: 3[log]
maxAge = 3--log.maxage=3compress¶
compress determines if the rotated log files should be compressed using gzip.
The default is not to perform compression.
log:
compress: true[log]
compress = true--log.compress=trueUsing Traefik OSS in Production?
If you are using Traefik at work, consider adding enterprise-grade API gateway capabilities or commercial support for Traefik OSS.
Adding API Gateway capabilities to Traefik OSS is fast and seamless. There's no rip and replace and all configurations remain intact. See it in action via this short video.