Skip to content

Traefik: enable JSON access log with client address - #802

Merged
gonzaloaune merged 1 commit into
masterfrom
strut/1795710771453
Nov 26, 2026
Merged

gonzaloaune merged 1 commit into
masterfrom
strut/1795710771453

Conversation

@gonzaloaune

Copy link
Copy Markdown
Contributor

I added the Traefik access-log flags in _traefik in src/images/traefik.rs. I haven't built, type-checked or run anything.

  • Flags: the six flags you listed are pushed onto cmd, placed after the TRAEFIK_STAGING/TRAEFIK_INSECURE blocks. The access log is on by default.
  • Opt-out: setting TRAEFIK_ACCESS_LOG=false (case-insensitive) leaves all six out. An unset variable or any other value keeps the log on. This differs from TRAEFIK_STAGING and TRAEFIK_INSECURE, which treat any value as "set", because those can't express "off".
  • Sensitive headers: defaultmode=drop stays, and only User-Agent, X-Forwarded-For and X-Real-Ip are kept.
  • Comment: next to the flags, it says that behind a load balancer or CDN you need forwardedHeaders.trustedIPs on both entrypoints (or proxyProtocol.trustedIPs for an L4 balancer) for the logged address to be the real client's. I added no trustedIPs or proxy-protocol settings.
  • Docs: a search found no docs, README or env example that mention TRAEFIK_STAGING or TRAEFIK_INSECURE, so I edited none.
  • Tests: the file has no unit tests that assert the cmd flags, so there was nothing to update.

I couldn't check that Traefik v2.11.63 accepts these flags as written, or that the JSON logs reach CloudWatch through Fluent Bit.

I added the Traefik access-log flags in `_traefik` in `src/images/traefik.rs`. I haven't built, type-checked or run anything.

- **Flags:** the six flags you listed are pushed onto `cmd`, placed after the TRAEFIK_STAGING/TRAEFIK_INSECURE blocks. The access log is on by default.
- **Opt-out:** setting `TRAEFIK_ACCESS_LOG=false` (case-insensitive) leaves all six out. An unset variable or any other value keeps the log on. This differs from TRAEFIK_STAGING and TRAEFIK_INSECURE, which treat any value as "set", because those can't express "off".
- **Sensitive headers:** `defaultmode=drop` stays, and only User-Agent, X-Forwarded-For and X-Real-Ip are kept.
- **Comment:** next to the flags, it says that behind a load balancer or CDN you need `forwardedHeaders.trustedIPs` on both entrypoints (or `proxyProtocol.trustedIPs` for an L4 balancer) for the logged address to be the real client's. I added no trustedIPs or proxy-protocol settings.
- **Docs:** a search found no docs, README or env example that mention TRAEFIK_STAGING or TRAEFIK_INSECURE, so I edited none.
- **Tests:** the file has no unit tests that assert the `cmd` flags, so there was nothing to update.

I couldn't check that Traefik v2.11.63 accepts these flags as written, or that the JSON logs reach CloudWatch through Fluent Bit.
@gonzaloaune
gonzaloaune merged commit 620460d into master Nov 26, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant