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.
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
Path to the access log file. If not specified, logs are written to stdout.
Format
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
Enable access logs for internal resources like
ping@internal.Buffering
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
Log only requests with specific status codes or ranges.
Retry Attempts
Log only requests that were retried at least once.
Minimum Duration
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
Default action for fields:
keep or drop.Field Names
Override specific field behavior:
keep or drop.Header Fields
Default action for headers:
keep, drop, or redact.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:| Field | Description |
|---|---|
StartUTC | Request start time in UTC |
StartLocal | Request start time in local timezone |
Duration | Total processing time in nanoseconds |
RouterName | Traefik router name |
ServiceName | Traefik service name |
ServiceURL | Backend service URL |
ServiceAddr | Backend IP:port |
ClientAddr | Client address (IP:port) |
ClientHost | Client IP address |
ClientPort | Client TCP port |
ClientUsername | HTTP basic auth username |
RequestAddr | HTTP Host header (IP:port) |
RequestHost | HTTP Host (without port) |
RequestPort | HTTP Host port |
RequestMethod | HTTP method (GET, POST, etc.) |
RequestPath | Request URI path |
RequestProtocol | HTTP version |
RequestScheme | http or https |
RequestLine | Full request line |
RequestContentSize | Request body size in bytes |
OriginDuration | Upstream processing time |
OriginContentSize | Upstream response size |
OriginStatus | Upstream HTTP status |
DownstreamStatus | Status returned to client |
DownstreamContentSize | Response size to client |
RequestCount | Total requests since startup |
GzipRatio | Compression ratio |
Overhead | Traefik processing overhead |
RetryAttempts | Number of retries |
TLSVersion | TLS version (1.2, 1.3) |
TLSCipher | TLS cipher suite |
TLSClientSubject | Client certificate subject |
TraceId | Distributed trace ID (32-hex) |
SpanId | Root span ID (16-hex) |
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.)