Add host to access logs

Hi ,
I'm using traefik with helm
I'm trying to have access logs, so I added-

logs:
  access:
    enabled: true
    fields:
      headers: 
        defaultMode: keep
        names:
          defaultMode: keep
          User-Agent: keep
          Autorization: keep
          Content-Type: keep

I see all access logs but with no HOST , just path and more details
there is a way to have also a host in those logs ?

By default, logs are written using the Common Log Format (CLF).

If you want to add fields, you must switch to JSON format (doc).

You can then try to create plain-text logs with post-processing, for example with jq. Untested example from Internet:

tail -f traefik-access.json \
  | jq -c '[ .ClientAddr, .RequestMethod, "\(.RequestHost)\(.RequestPath)" ]'

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