How can I log the full request url within a traefik reverse proxy

1.6k Views Asked by At

When I setup Traefik as a reverse proxy I have some options for access logs as described here: https://doc.traefik.io/traefik/observability/access-logs/#limiting-the-fieldsincluding-headers.

All available fields.names should be visible by default. But I get only the URL path in access log output like
"GET /path/to/my/site HTTP/1.1"

Is there a way to display the requested domain, e.g.
"GET mydomain.com/path/to/my/site HTTP/1.1"?

I need to figure out which domain was used for the request.

1

There are 1 best solutions below

1
Seth Linn On

In traefik 2.x you can set this in your traefik.yaml file:

accessLog:
  filePath: "/logs/traefik.log"
  bufferingSize: 100
  format: json

The resulting json will have "RequestAddr":"mydomain.com" along with allot of other fields.