Skip to content

Read the Traefik logs

How-toDeployrr v6.0+CurrentTraefikLogsRemote accessShell

Traefik is the reverse proxy that sends web traffic to your apps. When an app does not load, or a certificate fails, the Traefik logs usually say why. This page shows where the logs are, how to read them, how to make them more or less detailed, and how to keep them from filling your disk.

  • Deployrr is installed and Traefik is set up.
  • You can open a terminal on your server.
  • Optional: turn on the Deployrr bash aliases. This page uses cdd, traefiklogs and dcrec.

Traefik writes two files:

File What is in it
traefik.log Traefik’s own messages: startup, certificate requests, routing and middleware errors.
access.log One line for each request that Traefik handled, filtered by status code.

They are in the logs/HOSTNAME/traefik/ folder inside your Docker folder. HOSTNAME is your server’s hostname. Deployrr recommends /home/YOUR_USER/docker as the Docker folder, but you choose it in Prerequisites, so yours may be elsewhere.

  1. Go to your Docker folder.

    Terminal window
    cdd

    Without the aliases, use cd YOUR_DOCKER_FOLDER. Replace YOUR_DOCKER_FOLDER with the path to your Docker folder.

  2. List the log files.

    Terminal window
    ls -lh logs/$HOSTNAME/traefik/

    Bash fills in $HOSTNAME for you. You should see traefik.log and access.log.

When you run Proxy > Traefik > Production (Setup Traefik Production), Deployrr renames the old log to traefik_staging.log and starts a new traefik.log. Deployrr doesn’t trim or rotate these files, so they can grow large over time. See Keep the log files small below, and Free up disk space used by Docker for other things that fill your disk.

  1. Run the alias:

    Terminal window
    traefiklogs

    Or run the same thing yourself from your Docker folder:

    Terminal window
    tail -f logs/$HOSTNAME/traefik/traefik.log
  2. Open the app or page that fails in your browser.

  3. Watch for new lines.

  4. Press Ctrl+C to stop.

If you see Permission denied, put sudo in front of the command.

To see the log followed during a first certificate request, watch Traefik 3 guide: following traefik.log during staging at 45:23 (manual Docker Compose setup; Deployrr does these steps for you).

There is no alias for the access log. Run this from your Docker folder:

Terminal window
tail -f logs/$HOSTNAME/traefik/access.log

Traefik keeps access log lines in a buffer of 100 lines before it writes them to the file. New requests can show up late, or in a batch. Load the page a few times if nothing appears.

The access log skips most successful requests. It records status codes 204 to 299, 400 to 499 and 500 to 599. A normal 200 response is not logged.

Search the log for a word instead of reading everything. For example, to show the last certificate lines:

Terminal window
grep -i acme logs/$HOSTNAME/traefik/traefik.log | tail -n 20
Where What you see What it usually means
traefik.log Lines with acme or certificate and the word error Traefik could not get or renew a Let’s Encrypt certificate. See Traefik can’t get a Let’s Encrypt certificate.
traefik.log A message that a middleware does not exist or cannot be found A router uses a middleware name that Traefik does not know. Check the spelling in the app’s Traefik file.
traefik.log Messages about a router or service for one app The app’s Traefik file has a mistake. See the note below the table.
access.log A 404 for your app’s address Traefik found no router for that address. The address in the app’s Traefik file does not match what you typed. See Open a dashboard at your root domain for how the rule: line sets the address.
access.log A 502 for your app’s address Traefik found the router but could not reach the app. The app may be stopped, still starting, or on the wrong port.

Each app’s Traefik file is app-APPNAME.yml in the appdata/traefik3/rules/HOSTNAME/ folder inside your Docker folder. A few apps, such as Traefik itself, OAuth and Authelia, use labels in their file in compose/HOSTNAME/ instead.

For a 502, check that the app is running:

Terminal window
dpss

For a checklist that starts from the 404, 502 or Gateway Timeout you see, read One app behind Traefik shows 404, 502 or Gateway Timeout.

To understand how the logs and common errors fit together, read UDMS part 18: Learn to read Traefik logs (manual setup; folder names differ from Deployrr).

Deployrr starts Traefik with the log level set to DEBUG. This is the most detailed level. It is good while you set things up, but it makes traefik.log grow fast. During the production setup, Deployrr shows a message that it is changing the level to INFO. Check your file to confirm: the steps below show where the level is set.

The levels, from most to least detail, are DEBUG, INFO, WARN, ERROR, FATAL and PANIC.

  1. Open Traefik’s compose file in your Docker folder:

    Terminal window
    cdd
    nano compose/$HOSTNAME/traefik.yml

    If your editor is not nano, use the one you prefer.

  2. Find the line that starts with - --log.level=. It has a note after it that lists the levels:

    - --log.level=DEBUG
  3. Change only the level word, for example DEBUG to INFO. Leave the note after it as it is.

  4. Save the file.

  5. Recreate Traefik so it reads the change:

    Terminal window
    dcrec traefik

    Without the aliases, run:

    Terminal window
    sudo docker compose --profile all -f YOUR_DOCKER_FOLDER/docker-compose-HOSTNAME.yml up -d --force-recreate --remove-orphans traefik

    Replace YOUR_DOCKER_FOLDER and HOSTNAME with your own values.

Recreating Traefik drops web connections for a few seconds.

Check how much space the logs use. Run this from your Docker folder:

Terminal window
sudo du -sh logs/$HOSTNAME/traefik/*

The dlogsize alias doesn’t help here. It shows the size of Docker’s own container logs, not these files.

The log files grow in different ways:

  • traefik.log: Traefik’s own documentation says it starts a new file when this one reaches 100 MB. It keeps every old file, compressed, in the same folder. The DEBUG level fills it fastest, so change the log level to INFO first.
  • access.log: Traefik never starts a new file for this one. It grows until you rotate it.
  • traefik_staging.log: the old log from before the production setup. Nothing writes to it any more. Once your apps open with a trusted certificate, you can delete it with sudo rm logs/$HOSTNAME/traefik/traefik_staging.log. You can’t get it back after that.
  1. Back up Traefik’s compose file, then open it:

    Terminal window
    cdd
    cp compose/$HOSTNAME/traefik.yml compose/$HOSTNAME/traefik.yml.bak
    nano compose/$HOSTNAME/traefik.yml
  2. Below the - --log.level= line, add two lines with the same indent:

    - --log.maxSize=50 # MB per file
    - --log.maxBackups=3 # old files to keep
  3. Save the file and recreate Traefik. This drops web connections for a few seconds.

    Terminal window
    dcrec traefik
  4. Check that Traefik is running with dps. If it keeps restarting, put the backup back with cp compose/$HOSTNAME/traefik.yml.bak compose/$HOSTNAME/traefik.yml and recreate Traefik with dcrec traefik.

Some Deployrr actions write a fresh traefik.yml, for example deleting Traefik in Stack Manager and installing it again. If that happens, add the two lines again. See What overwrites or deletes your changes.

logrotate is a standard Linux tool that renames and compresses log files on a schedule. It runs once a day on Ubuntu and Debian. Traefik’s documentation says it opens access.log again when it gets the USR1 signal. The rule below sends that signal after each rotation.

  1. Find the full path of the file. Run this from your Docker folder:

    Terminal window
    realpath logs/$HOSTNAME/traefik/access.log
  2. Create the rule file:

    Terminal window
    sudo nano /etc/logrotate.d/traefik-access

    Paste this. Replace the first line with the path from step 1:

    /home/YOUR_USER/docker/logs/HOSTNAME/traefik/access.log {
    su root root
    weekly
    maxsize 50M
    rotate 4
    compress
    delaycompress
    missingok
    notifempty
    postrotate
    docker kill --signal=USR1 traefik > /dev/null 2>&1 || true
    endscript
    }

    This keeps four old files. It starts a new file each week, or sooner if the file is over 50 MB when logrotate runs.

  3. Test the rule without changing anything:

    Terminal window
    sudo logrotate -d /etc/logrotate.d/traefik-access

    The output should name your access.log and show no error: lines.

  4. Optional: rotate once now to see it work:

    Terminal window
    sudo logrotate -f /etc/logrotate.d/traefik-access
    ls -lh logs/$HOSTNAME/traefik/

    You should see access.log.1 next to a new access.log. Open one of your apps a few times. The new access.log should get lines again, after the 100-line buffer fills.

If the new access.log stays empty while the old one keeps growing, Traefik didn’t get the signal. Recreate Traefik with dcrec traefik so it opens the new file.

If you prefer a web page to the terminal, you can read both files in Dozzle. These apps need all Prerequisites steps done and Proxy > Traefik > Production (Setup Traefik Production) done. If something is missing, Deployrr shows a Requirements Not Met box that lists it.

Install each app from Apps > Browse Apps: select the app, then choose Install.

  1. Install Dozzle if you do not have it yet. It needs the Socket Proxy app.
  2. Install Traefik Error Log for Dozzle. It shows traefik.log.
  3. Install Traefik Access Log for Dozzle. It shows access.log.
  4. Open Dozzle and pick traefik-error-log or traefik-access-log in the container list.

When an install finishes, Deployrr shows Traefik Error Logs should now be available on Dozzle. or Traefik Access Logs should now be available on Dozzle.

  • ls -lh logs/$HOSTNAME/traefik/ lists both files, and traefik.log is not empty.
  • traefiklogs prints lines, and new lines appear when you open one of your apps.
  • After a log level change, traefik.log grows more slowly or fills with fewer detail lines.
  • After a test rotation, access.log.1 exists and the new access.log gets lines.