Hi!
I'm trying to configure the access log in order to get all the requests/responses resulting in 400 to 499 status code.
I'm using a docker compose file and CLI arguments to configure it:
- "--accesslog=true"
- "--accesslog.filepath=/var/log/access.log"
- "--accesslog.filters.statuscodes=400"
- "--accesslog.filters.retryattempts"
- "--accesslog.filters.minduration=10ms"
I tried with just status code 400 for simplifying even more the example.
I'm able to see in the service logs that the configuration is apparently parsed correctly:
Static configuration loaded [json] staticConfiguration={"accessLog":{"fields":{"defaultMode":"keep","headers":{"defaultMode":"drop"}},"filePath":"/var/log/access.log","filters":{"minDuration":"10ms","retryAttempts":true,"statusCodes":["400"]},"format":"common"},
....
After that, I try to access any of my configured services and they work as usual, but in the access log I see all the requests/responses for all status codes.
Am I doing something wrong?
Share your full Traefik static and dynamic config, and docker-compose.yml
if used.
compose file
services:
traefik:
container_name: traefik
image: traefik:latest
command:
- "--api.insecure=true"
- "--entrypoints.web.address=:80"
- "--entrypoints.websecure.address=:443"
- "--entrypoints.web.http.redirections.entrypoint.to=websecure"
- "--entrypoints.web.http.redirections.entrypoint.scheme=https"
- "--providers.docker"
- "--providers.docker.exposedbydefault=false"
- "--providers.file.directory=/etc/traefik"
- "--log.level=DEBUG"
- "--certificatesResolvers.letsencrypt.acme.email=XXXXXXXX@YYYYYYY.com"
- "--certificatesResolvers.letsencrypt.acme.storage=/etc/traefik/acme.json"
- "--certificatesResolvers.letsencrypt.acme.dnsChallenge.provider=duckdns"
- "--certificatesResolvers.letsencrypt.acme.dnsChallenge.delayBeforeCheck=0"
- "--accesslog=true"
- "--accesslog.filepath=/var/log/access.log"
- "--accesslog.filters.statuscodes=400"
- "--accesslog.filters.retryattempts"
- "--accesslog.filters.minduration=10ms"
- "--entrypoints.websecure.http.tls.certResolver=letsencrypt"
- "--entrypoints.websecure.http.tls.domains[0].main=XXXXXX.duckdns.org"
- "--entrypoints.websecure.http.tls.domains[0].sans=*.XXXXXX.duckdns.org"
- "--experimental.plugins.rewriteHeaders.modulename=github.com/bitrvmpd/traefik-plugin-rewrite-headers"
- "--experimental.plugins.rewriteHeaders.version=v0.0.1"
environment:
- DUCKDNS_TOKEN=${DUCKDNS_TOKEN}
ports:
- "80:80"
- "443:443"
- "8080:8080"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /etc/localtime:/etc/localtime:ro
- /media/hdd/etc/traefik:/etc/traefik
I don't use any static file, and tbh I don't know what are you referring with dynamic config. Is there a way to dump the dynamic configuration from the dashboard?