chore(caddy): switch access log format from console to json for stack-wide log uniformity#152
Merged
Merged
Conversation
…-wide log uniformity The TLS reverse-proxy layer wrote Caddy's access logs in `console` format — free-text columns intended for human eyeballs. The application service (pino) writes structured JSON, one object per line. Both go to the container's stdout, where any log shipper (Vector, Loki, CloudWatch Logs Insights, etc.) parses line-by-line. The mixed-format split causes parser failure or "raw" fallback on the Caddy lines, splitting the operator's view: Loki queries that filter on `level=error` or `status>=500` only match application lines and silently miss Caddy's 4xx/5xx. Dashboard charts that try to plot request volume cross-stack end up showing only the API's side of the door. Flip Caddy to `format json`. Now every line on stdout is the same shape — application logs and access logs alike — and downstream queries can JOIN on `request.headers.X-Request-Id` (Caddy logs it; the API echoes / regenerates it on the way in). Caddy's duration / size / status fields land in dashboards alongside the application's pino events. No application code touched; CI tests unchanged at 595 passed. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Closes #151.
Summary
caddy/Caddyfilewrote access logs inconsoleformat. The application service (pino) writes structured JSON. Both go to the same container stdout, where log shippers parse line-by-line — the mixed-format split caused parser failure / raw fallback on the Caddy lines and meant queries filtering onlevel=error/status>=500silently missed Caddy-level 4xx/5xx.Flip Caddy to
format json. Whole container stdout stream becomes one uniform structured format; cross-layer correlation byX-Request-Idworks because Caddy logs the request header and the API echoes the same id back.Test plan
npm run lint— cleannpm test— 595 passed, 15 skipped (no application code touched)Proudly Made in Nebraska. Go Big Red! 🌽 https://xkcd.com/2347/