Persist K3S Traefik Logs to HostPath

We are using K3S with traefik ingress and would like the access logs persisted to a hostPath volume /var/log/somewhere/traefik/.

In the HelmChartConfig resource we have:

    logs:
      access:
        enabled: true

    volumes:
    - hostPath:
        path: /var/log/somewhere/traefik/
      name: traefik-logs
      type: DirectoryOrCreate
      mountPath: /var/log/traefik/

Expected: The logs are written to the host path /var/log/somewhere/traefik/
Result: No logs are written to the host. Logs are only visible via kubectl logs pod

Apparently traefik is logging to stdout only, can we change this?

10.9.100

Also, it seems the helm chart mounts all volumes as readOnly link so maybe we are going about this the wrong way.

Well, we managed to find the logs on the host under /var/log/pods/kube-system_traefik-p57ht_b269e9ba-6d75-4b10-b689-41c4e93eef42/traefik.

1 Like

Hi @cawoodm,
Thanks for your interest in Traefik, and sorry for the late answer.

We are glad to see you managed to fix your issue.

Maxence

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