[SOLVED] Does Traefik have a way to custom format the access log and get the Request_Id?

Its not just the field. Jaeger needs to be enabled. Standby for a minimal configuration.

version: "3.8"

services:
  traefik:
    image: "traefik:v2.4"
    command:
    - --entrypoints.web.address=:80
    - --providers.docker=true
    - --providers.docker.exposedbydefault=false
    - --accesslog
    - --accesslog.format=json
    - --accesslog.fields.headers.defaultmode=keep
    - --accesslog.fields.headers.names.x-request-id=keep
    - --api
    - --log.level=INFO
    - --log.format=json
    - --tracing.jaeger=true
    - --tracing.jaeger.samplingParam=0
    - --tracing.jaeger.traceContextHeaderName=x-request-id
    ports:
      - published: 80
        target: 80
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock:ro"
  whoami:
    image: traefik/whoami
    labels:
      traefik.enable: "true"
      traefik.http.routers.whoami.rule: PathPrefix(`/whoami`)

1 Like