Access Logs Configuration
Access logs provide detailed information about every request handled by Traefik, including source IP, request details, response status, processing time, and more.Overview
Access logs enable you to:- Monitor incoming traffic patterns
- Analyze request/response metrics
- Debug routing issues
- Track client behavior
- Audit security events
- Generate analytics
Basic Configuration
Enable access logs:Configuration Options
File Path
string
default:"stdout"
Path to the access log file. If not specified, logs are written to stdout.
Format
string
default:"common"
Log output format:
common, genericCLF, or json.- Common (Traefik CLF)
- Generic CLF
- JSON
Traefik’s extended Common Log Format with additional fields:Format:Example:
Add Internals
boolean
default:"false"
Enable access logs for internal resources like
ping@internal.Buffering
integer
default:"0"
Number of log lines to buffer in memory before writing. Improves performance for high-traffic scenarios.
Filtering
Filter access logs to reduce volume and focus on specific requests:Status Codes
array
default:"[]"
Log only requests with specific status codes or ranges.
Retry Attempts
boolean
default:"false"
Log only requests that were retried at least once.
Minimum Duration
duration
default:"0"
Log only requests that took longer than specified duration.
Combined Filters
Filters are OR-connected (any matching filter will log the request):- Have 4xx or 5xx status codes, OR
- Were retried at least once, OR
- Took longer than 100ms
Field Customization
Control which fields are logged:Default Mode
string
default:"keep"
Default action for fields:
keep or drop.Field Names
object
default:"{}"
Override specific field behavior:
keep or drop.Header Fields
string
default:"drop"
Default action for headers:
keep, drop, or redact.object
default:"{}"
Override specific header behavior:
keep, drop, or redact.keep- Include header valuedrop- Exclude header completelyredact- Replace value with “REDACTED”
Available Fields
Complete list of available fields in access logs:Time Zones
By default, timestamps use UTC. Configure local timezone:Using Environment Variable
Using Volume Mount
Drop
StartUTC and keep StartLocal to use local timestamps.Log Rotation
Traefik supports external log rotation using USR1 signal:logrotate configuration:
Windows SupportUSR1 signal rotation is not supported on Windows.
OpenTelemetry Access Logs
Experimental FeatureOpenTelemetry access logs are currently experimental.
Enable Experimental Feature
OTLP Configuration
Same configuration options as Traefik logs:serviceName- Service identifierresourceAttributes- Additional attributeshttp- HTTP protocol configurationgrpc- gRPC protocol configurationtls- TLS settings
Complete Examples
Production Setup
Development Setup
High-Traffic Optimized
Security-Focused Logging
Best Practices
Performance
- Use buffering for high-traffic deployments
- Filter logs to reduce volume
- Use JSON format for structured log processing
- Avoid logging all headers (high overhead)
Security
- Drop or redact sensitive headers (Authorization, Cookie, API keys)
- Don’t log request/response bodies
- Secure log files with appropriate permissions
- Rotate logs regularly to prevent disk exhaustion
Monitoring
- Log errors and slow requests (use filters)
- Include trace IDs for distributed tracing correlation
- Monitor log file sizes
- Integrate with log aggregation systems (ELK, Loki, etc.)