Cloudlfare tunnel logfile in docker

Hi All,

I hope it the correct place to ask this question. I have the clourflared docker running for a zero trust tunnel. I want to have the logfile so it can be sent to Loki. Add the --logile to the command and add the needed volume.
Yet it keeps complainint it has no permisision to write the file
{"level":"error","time":"2024-06-30T19:34:52Z","message":"Falling back to a default logger due to logger setup failure: unable to create a new logfile: open /tmp/mytunnel.log: permission denied"}

It only work when it don't right it in a folder. Does anyone know who i can get the log file in a volume
services:
  cloudflared:
    image: cloudflare/cloudflared:2024.6.1
    container_name: cloudflared
    environment:
      - TZ=Europe/Amsterdam # Change this to your timezone
      - TUNNEL_TOKEN=${TOKEN}
      - TUNNEL_METRICS=0.0.0.0:60123
    restart: unless-stopped
    command: tunnel --no-autoupdate --logfile /tmp/mytunnel.log run 
    volumes:
      - /home/sven/cloudflared:/tmp
    networks:
      - cloudflared
    labels:
      org.label-schema.group: "Proxies"

networks:
  cloudflared:
    name: cloudflared
Was this page helpful?