Gateway Gus saysStructured logging emits machine-parseable JSON with levels and a correlation id.
Plain text logs are hard to search at scale. Structured logs emit JSON ({ level, msg, requestId, userId, ... }) so log systems can filter and aggregate. Use levels (debug/info/warn/error) to control verbosity, and include a correlation id so you can trace one request's logs across services. Never log secrets or full payloads with PII.
Power-ups you unlock
JSON logs are queryable at scale
Levels: debug/info/warn/error
Correlation id ties a request’s logs together
Never log secrets or PII
Timeout Titan attacks — common mistakes
Unstructured string logs you can’t query
Logging tokens, passwords, or PII
No correlation id across services
Boss battleDesign a structured log line for a failed login attempt.
Example code
<!doctype html><html><head><meta charset="utf-8"></head>
<body style="background:#06040d;color:#e6e0ff;font-family:monospace;padding:20px"><pre>{ "level":"warn", "msg":"login_failed",
"requestId":"abc123", "email":"d***@x.com",
"reason":"bad_password" } ← no raw password</pre></body></html>