Where are Traefik logs?

To see logs in the stdout event if you run docker-compose up -d:

docker-compose logs -f

https://docs.docker.com/compose/reference/logs/

FYI The path ./traefik.log is inside the Traefik container.

[traefikLog]
  filePath = "./traefik.log" 

With your files (without the section [traefikLog]), I see the logs.


However, your configuration have some issues:

version: '3'
services:
  traefik:
    hostname: traefik
    domainname: exampledomain.net
    image: traefik:v1.7.9-alpine
    # command: --api --docker # <-- don't define the same configuration with CLI and TOML https://docs.traefik.io/basics/#static-traefik-configuration
    container_name: traefik
    networks:
      - nginx-proxy
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock"
      - "./traefik/traefik.toml:/traefik.toml"
      - "./traefik/acme.json:/acme.json"
    labels:
      - "traefik.enable=true"
      - "traefik.port=8080"
      - "traefik.frontend.rule=Host:monitor.exampledomain.net"
      - "traefik.docker.network=nginx-proxy"

networks:
  nginx-proxy:
    external:
      name: nginx-proxy
logLevel = "DEBUG"
defaultEntryPoints = ["http","https"]

[api]
  # address = ":8080" <- this options doesn't exist. https://docs.traefik.io/v1.7/configuration/api/

# [traefikLog] # <-- remove because not needed
#   filePath = "./traefik.log"

# [accessLog] # <-- remove because not needed
#   filePath = "./access.log"

[entryPoints]
  [entryPoints.http]
    address = ":80"
    [entryPoints.http.redirect]
      entryPoint = "https"
  [entryPoints.https]
    address = ":443"
    [entryPoints.https.tls]

# Let's encrypt setup
[acme]
  email = "[email protected]"
  storage = "acme.json"
  entryPoint = "https"
  acmeLogging = true
  onHostRule = true
  onDemand = false
  [acme.httpChallenge]
    entryPoint = "http"

[docker]
  endpoint = "unix:///var/run/docker.sock"
  domain = "exampledomain.net"
  # watch = true # <---- useful only for swarm
  exposedbydefault = false

Just add [accessLog] to your traefik.toml file and you are fine.


I am sharing a docker-compose file, which will create a volume for both access logs and service logs:

"networks":
  "network":
    "external":
      "name": "appliance"
"services":
  "container":
    "container_name": "traefik"
    "image": "traefik:1.7.4"
    "networks":
    - "network"
    "ports":
    - "80:80"
    - "443:443"
    - "8099:8099"
    "restart": "always"
    "volumes":
    - "/var/run/docker.sock:/var/run/docker.sock"
    - "{pwd}/traefik.toml:/traefik.toml"
    - "{pwd}/acme.json:/acme.json"
    - "logs:/var/log/traefik"
"version": "3.4"
"volumes":
  "logs":
    "name": "traefik_logs"

Add the log location in traefik.toml as follows:

[accessLog]
filePath = "/var/log/traefik/access.log"

Tags:

Docker

Traefik