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.

File (YAML)

  1. # Writing Logs to a File
  2. log:
  3. filePath: "/path/to/traefik.log"

File (TOML)

  1. # Writing Logs to a File
  2. [log]
  3. filePath = "/path/to/traefik.log"

CLI

  1. # Writing Logs to a File
  2. --log.filePath=/path/to/traefik.log

format

By default, the logs use a text format (common), but you can also ask for the json format in the format option.

File (YAML)

  1. # Writing Logs to a File, in JSON
  2. log:
  3. filePath: "/path/to/log-file.log"
  4. format: json

File (TOML)

  1. # Writing Logs to a File, in JSON
  2. [log]
  3. filePath = "/path/to/log-file.log"
  4. format = "json"

CLI

  1. # Writing Logs to a File, in JSON
  2. --log.filePath=/path/to/traefik.log
  3. --log.format=json

level

By default, the level is set to ERROR.

Alternative logging levels are TRACE, DEBUG, INFO, WARN, ERROR, FATAL, and PANIC.

File (YAML)

  1. log:
  2. level: DEBUG

File (TOML)

  1. [log]
  2. level = "DEBUG"

CLI

  1. --log.level=DEBUG

noColor

When using the ‘common’ format, disables the colorized output.

File (YAML)

  1. log:
  2. noColor: true

File (TOML)

  1. [log]
  2. noColor = true

CLI

  1. --log.nocolor=true

Log 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.

File (YAML)

  1. log:
  2. maxSize: 1

File (TOML)

  1. [log]
  2. maxSize = 1

CLI

  1. --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).

File (YAML)

  1. log:
  2. maxBackups: 3

File (TOML)

  1. [log]
  2. maxBackups = 3

CLI

  1. --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.

File (YAML)

  1. log:
  2. maxAge: 3

File (TOML)

  1. [log]
  2. maxAge = 3

CLI

  1. --log.maxage=3

compress

compress determines if the rotated log files should be compressed using gzip. The default is not to perform compression.

File (YAML)

  1. log:
  2. compress: true

File (TOML)

  1. [log]
  2. compress = true

CLI

  1. --log.compress=true