Repository navigation
Traefik: enable JSON access log with client address - #802
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I added the Traefik access-log flags in
_traefikinsrc/images/traefik.rs. I haven't built, type-checked or run anything.cmd, placed after the TRAEFIK_STAGING/TRAEFIK_INSECURE blocks. The access log is on by default.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".defaultmode=dropstays, and only User-Agent, X-Forwarded-For and X-Real-Ip are kept.forwardedHeaders.trustedIPson both entrypoints (orproxyProtocol.trustedIPsfor an L4 balancer) for the logged address to be the real client's. I added no trustedIPs or proxy-protocol settings.cmdflags, 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.