Forward bounded Caddy access log fields - #487
Merged
Merged
Conversation
Sayan-
marked this pull request as ready for review
September 22, 2026 20:34
hiroTamada
approved these changes
Sep 23, 2026
hiroTamada
left a comment
Contributor
There was a problem hiding this comment.
looks good — the selected fields preserve useful request diagnostics without forwarding raw access-log messages or request secrets. all three forwarding tests passed in isolation; package-level execution was blocked by the missing embedded Caddy binary.
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.
Summary
Caddy emits request, status, byte count, and duration fields in access logs, but the forwarder discarded them during JSON parsing. This retains the fields needed to identify failures and correlate requests while limiting what reaches telemetry.
Validation
New tests cover a representative access entry, retained status and byte counts, bounded methods, unchanged non-access entries, and omission of request secrets from forwarded output. The package tests used an ignored placeholder for the embedded Caddy binary absent from this shallow checkout; they did not exercise a running Caddy process.
Note
Medium Risk
Changes what request-related data leaves the host for telemetry; the design reduces leakage but still adds host digests and status/method attributes to OTEL logs.
Overview
Caddy access logs forwarded to OTEL now carry a bounded set of HTTP attributes (method, status, byte counts, duration) instead of dropping those fields during parse.
For
http.log.accessentries, the forwarder uses a fixed "caddy: handled request" message and adds normalized attributes: HTTP methods outside the standard set becomeOTHER, and the Host header is emitted only as a lowercased SHA-256 digest (http_host_sha256) for correlation—not the raw value. URI, client IP, headers, and other request details stay out of forwarded output; access msg/error text from Caddy is not relayed.Non-access Caddy logs still forward module, adapter, and error fields as before. Malformed JSON is logged at debug with a generic message instead of echoing the raw line (avoiding accidental secret leakage).
New
logs_test.gotests assert the allowed fields, method bounding, non-access behavior, and that sensitive strings never appear in forwarded records.Reviewed by Cursor Bugbot for commit 1e655b7. Bugbot is set up for automated code reviews on this repo. Configure here.