161 Structured Logging and Correlation
161 Structured Logging and Correlation
Structured logs are event records, not formatted print statements.
Correlation Model
request_id/trace_id
-> log fields
-> metric labels (careful cardinality)
-> trace attributes
A single correlation key allows fast cross-signal debugging.
Schema Discipline
Keep a stable field set across services:
serviceenvrequest_idtrace_iderror_class
Inconsistent schemas make incident search expensive and error-prone.
Security Consideration
Logs are data exfiltration risk. Always design for redaction and sensitive-field filtering.