structured logging

Writing each log entry as named fields, such as status, duration and request identifier, instead of a free-text sentence.

In more detail

Structured entries, usually JSON, can be searched, filtered and counted by tools without fragile text parsing. Keep field names consistent across services and keep secrets and personal data out of every field.

Examples

{"event": "request", "hits": 1, "path": "/quotes/1", "release": "2026.09.11-a1b2c3"}
{"lvl":"info","msg":"Fetching profile","corrId":"req-abc"}
Prose: "order 1071 for user u4 totalling 31.86 pounds was accepted". Record: {"event": "order_accepted", "order_id": 1071, "total_gbp": 31.86, "user_id": "u4"}.

Related terms

Taught in

References