No access.log created

hello.
i'm trying to debug what's wrong in my traefik instance, but the access.log file is not created inside the container.

here's my docker-compose.yaml:

version: "3.5"
services:
  traefik:
    image: traefik:2.8
    command:
    - "--providers.file.directory=/srv/"
    - "--providers.file.watch=true"
    - "--entrypoints.web.address=:80"
    - "--entrypoints.web.http.redirections.entryPoint.to=:443"
    - "--entrypoints.web.http.redirections.entryPoint.scheme=https"
    - "--entrypoints.web.http.redirections.entrypoint.permanent=true"
    - "--entrypoints.websecure.address=:443"
    - "--serverstransport.insecureskipverify=true"
    
    - "--certificatesresolvers.crtresolver01.acme.httpchallenge=true"
    - "--certificatesresolvers.crtresolver01.acme.httpchallenge.entrypoint=web"
    - "--certificatesresolvers.crtresolver01.acme.email=root@company.name"
    - "--certificatesresolvers.crtresolver01.acme.storage=/letsencrypt/acme01.json"
    
    - "--certificatesresolvers.crtresolver02.acme.httpchallenge=true"
    - "--certificatesresolvers.crtresolver02.acme.httpchallenge.entrypoint=web"
    - "--certificatesresolvers.crtresolver02.acme.email=root@company.name"
    - "--certificatesresolvers.crtresolver02.acme.storage=/letsencrypt/acme02.json"
    
    ports:
    - "80:80"
    - "443:443"
    volumes:
    - ./letsencrypt:/letsencrypt
    - ./srv:/srv

    restart: always

and here is /srv/config.yaml:

serversTransport:
  maxIdleConnsPerHost: -1

accessLog:
  filePath: "/var/log/access.log"

http:
  routers:
    
    router01:
      entryPoints:
      - websecure
      service: webUpstream
      rule: "Host(`domain1.company.name`)"
      tls:
        certresolver: crtresolver01
      middlewares:
      - default-headers
    
    router02:
      entryPoints:
      - websecure
      service: webUpstream
      rule: "Host(`domain2.company.name`)"
      tls:
        certresolver: crtresolver02
      middlewares:
      - default-headers
    
  services:
    webUpstream:
      loadBalancer:
        sticky:
          cookie: {}
        passHostHeader: true
        healthCheck:
          path: /
          interval: "15s"
          timeout: "5s"
        servers:
        
        - url: "https://service.company.name/"
        
  middlewares:
    default-headers:
      headers:
        frameDeny: true
        sslRedirect: true
        browserXssFilter: true
        contentTypeNosniff: true
        forceSTSHeader: true
        stsIncludeSubdomains: true
        stsPreload: true

could you help me to clarify what's going on?

Hello,

serversTransport and accessLog are a part of the static configuration.

The file provider handles the dynamic configuration.

So you have to remove serversTransport and accessLog from your dynamic configuration file and add the following lines to your Traefik static configuration:

 - "--serversTransport.maxIdleConnsPerHost=-1"
 - "--accessLog.filePath=/var/log/access.log"

I recommend validating your configuration files with a JSON schema and to take a look to your Traefik logs.

oh. thanks. I guess, I gotta read documentation more thoroughly.

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