Traefik v2.9 isn't creating logfiles

Hi there :wave:,

this is my first topic so I hope I'm doing everything correct :slight_smile:.
I've set up Traefik v2.9 on our server recently, upgrading von v1 that another person once installed.
I'm running into a few problems but the biggest before I can turn to any of them is that Traefik refuses to create logfiles.
I post my configs here:

docker-compose.yml

version: "3.3"

services:
  traefik:
    container_name: traefik
    image: "traefik:v2.9"
    ports:
      - "80:80"
      - "443:443"
    volumes:
#      - "/var/run/docker.sock:/var/run/docker.sock:ro"
      - "./acme.json:/acme.json"
      - "./traefik.yml:/traefik.yml:ro"
      - "./configfiles:/configfiles:ro"
    networks:
      - "proxy"
    labels:
      # HTTP router
      - "traefik.http.routers.traefik.entrypoints=http"
      - "traefik.http.routers.traefik.rule=HostRegexp(`{host:.+}`)"
      - "traefik.http.routers.traefik.middlewares=https-redirect"
      - "traefik.http.middlewares.https-redirect.redirectscheme.scheme=https"
      # HTTPS router
      - "traefik.http.routers.traefik-secure.entrypoints=https"
      - "traefik.http.routers.traefik-secure.rule=Host(`traefik.smns-bw.org`)"
      - "traefik.http.routers.traefik-secure.tls=true"
      - "traefik.http.routers.traefik-secure.tls.certresolver=leresolver"
      # API service
      - "traefik.http.routers.traefik-secure.service=api@internal"
      # Middlewares
#      - "traefik.http.routers.traefik-secure.middlewares=middlewares-basic-auth@file"

networks:
  proxy:
    external: true

traefik.yml

entryPoints:
  http:
    address: ":80"
  https:
    address: ":443"
  postgres:
    address: ":5434"

log:
  level: DEBUG
  filePath: /opt/traefik2/traefik.log
  format: json

api: {}

providers:
  docker:
    endpoint: "tcp://socket-proxy:2375"
    watch: true
    network: proxy
  file:
    directory: "/configfiles"
    watch: true

certificatesResolvers:
  leresolver:
    acme:
      email: "<our mail>"
      storage: "/acme.json"
      caServer: "https://acme-v02.api.letsencrypt.org/directory"
      tlsChallenge: {}

configfiles/config.yml

http:
  routers:
    webmin:
      entryPoints:
        - "websecure"
      rule: "Host(`webmin.<ourdomain>`)"
      tls:
        certResolver: leresolver
      service: webmin

    traefik:
      entryPoints:
        - "websecure"
      rule: "Host(`traefik.<ourdomain>`)"
      tls:
        certResolver: leresolver
      service: cookies
      middlewares:
        - secure

  services:
    webmin:
      loadBalancer:
        servers:
          - url: "http://172.18.0.1:10000/"
        passHostHeader: true

    cookies:
      loadBalancer:
        sticky:
          cookie:
            secure: true
            httpOnly: true

tls:
  options:
    default:
      minVersion: VersionTLS12
      cipherSuites:
        "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256",
        "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
        "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384",
        "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384",
        "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305",
        "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305"
      curvePreferences:
        - CurveP521
        - CurveP384
      sniStrict: true

This problem exists from the very beginning, even before config.yml was created. The static config file is very barely filled, this is due to the fast that as soon as I start adding content Traefik crashes. For example "exposedByDefault: false" makes the container crash.
As soon as logging is working I will open another topic to tackle my middlewares hassles :smiley:
But one after another. I hope someone has an idea!

Cheers
Velaya

That’s where your log file should be - within the Traefik container. As the path is not mounted from the host.

1 Like

I can't believe it!
I have tried so many possible ways.

I just added to docker-compose.yml:

      - "./traefik.log:/traefik.log"

And edited traefik.yml:

  filePath: /traefik.log

Thanks to you pointing me to this mistake I finally understood the logic behind those paths and I feel both stupid and enlighted :smiley:

Thank you very, very much!

Now I can stare at a logfile full of error-messages and start working on my middlewares before my co-workers kill me due to all our webpages being offline! :muscle: :wink:

Cheers,
Velaya

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.