Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/traefik/traefik/llms.txt

Use this file to discover all available pages before exploring further.

Logging Configuration

Traefik logs capture all operational events including startup, configuration changes, errors, and system warnings. By default, logs are written to stdout in text format.

Basic Configuration

Logs are enabled by default. Configure log level and format:
log:
  level: DEBUG
  format: json
  filePath: /var/log/traefik/traefik.log

Configuration Options

Log Level

level
string
default:"ERROR"
Set the logging level to control verbosity.
Available log levels (in order of verbosity):
  • TRACE - Most verbose, includes all debug information
  • DEBUG - Detailed debugging information
  • INFO - General informational messages
  • WARN - Warning messages
  • ERROR - Error messages (default)
  • FATAL - Fatal errors that cause termination
  • PANIC - Panic-level errors
log:
  level: DEBUG

File Path

filePath
string
default:"stdout"
Path to the log file. If not specified, logs are written to stdout.
When filePath is specified, Traefik writes logs only to the file (not to stdout). Intermediate directories are created automatically.
log:
  filePath: /var/log/traefik/traefik.log

Format

format
string
default:"common"
Log output format: common (text) or json.
Human-readable text format with optional colors:
log:
  format: common
Example output:
time="2026-03-03T10:00:00Z" level=info msg="Configuration loaded"

Disable Colors

noColor
boolean
default:"false"
Disable colorized output when using the common format.
log:
  format: common
  noColor: true

Log Rotation

Configure automatic log rotation to prevent disk space issues:

Max Size

maxSize
integer
default:"100"
Maximum size in megabytes before rotation.
log:
  filePath: /var/log/traefik/traefik.log
  maxSize: 50

Max Backups

maxBackups
integer
default:"unlimited"
Maximum number of old log files to retain.
log:
  maxBackups: 7

Max Age

maxAge
integer
default:"unlimited"
Maximum number of days to retain old log files.
log:
  maxAge: 30

Compression

compress
boolean
default:"false"
Compress rotated log files using gzip.
log:
  compress: true

Complete Rotation Example

log:
  filePath: /var/log/traefik/traefik.log
  maxSize: 100
  maxBackups: 3
  maxAge: 7
  compress: true

OpenTelemetry Logs

Experimental FeatureOpenTelemetry logs are currently experimental and must be explicitly enabled.

Enable Experimental Feature

experimental:
  otlpLogs: true

log:
  otlp: {}
Default protocol is HTTPS to https://localhost:4318/v1/logs.

Service Name

otlp.serviceName
string
default:"traefik"
Service name resource attribute for OTLP logs.
log:
  otlp:
    serviceName: traefik-prod

Resource Attributes

otlp.resourceAttributes
object
default:"{}"
Additional resource attributes sent to the collector.
log:
  otlp:
    resourceAttributes:
      environment: production
      datacenter: us-east-1

HTTP Configuration

Send logs via HTTP to the OpenTelemetry Collector:
log:
  otlp:
    http:
      endpoint: https://otel-collector:4318/v1/logs
      headers:
        Authorization: Bearer token123
      tls:
        ca: /path/to/ca.crt
        cert: /path/to/client.cert
        key: /path/to/client.key
To disable TLS, use http:// instead of https:// in the endpoint URL.

gRPC Configuration

Send logs via gRPC to the OpenTelemetry Collector:
log:
  otlp:
    grpc:
      endpoint: otel-collector:4317
      insecure: false
      headers:
        Authorization: Bearer token123
      tls:
        ca: /path/to/ca.crt

Complete Examples

Production Logging Setup

log:
  level: INFO
  format: json
  filePath: /var/log/traefik/traefik.log
  maxSize: 100
  maxBackups: 5
  maxAge: 30
  compress: true

Development Setup

log:
  level: DEBUG
  format: common

OpenTelemetry Integration

experimental:
  otlpLogs: true

log:
  level: INFO
  format: json
  otlp:
    serviceName: traefik-prod
    resourceAttributes:
      environment: production
      cluster: us-east
    http:
      endpoint: https://otel-collector:4318/v1/logs
      headers:
        X-API-Key: secret

External Log Rotation

On Linux/Unix systems, you can use logrotate for external log rotation. Traefik responds to USR1 signals to reopen log files:
kill -USR1 <traefik-pid>
Windows SupportUSR1 signal rotation is not supported on Windows.