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
- log — A time-stamped record of an individual event in a system, such as one request being handled; structured logs record it as named fields rather than free text.
- correlation ID — A unique value attached to one request and passed along everywhere it goes, so its logs and traces can be found together.
- observability — How well you can understand what a system is doing, and why, from the data it emits: mainly logs, metrics and traces.
- JSON — A simple text format for structured data made of keys, values, lists and nested objects.
- event stream — A continuous, time-ordered flow of events with no fixed beginning or end.
- trace ID — An identifier shared by every span and log line belonging to one request, so they can be found together.
- telemetry — The data a running system sends out about itself, such as logs, metrics and traces.
- redaction — Removing or hiding sensitive values, such as tokens or personal data, before data is logged, displayed or shared.
- centralized logging — Collecting logs from every service into one searchable system instead of reading each machine’s files.
- standard output and standard error — The two channels a program writes normal output (stdout) and error messages (stderr) to, plus stdin for input.
- newline-delimited JSON — A streaming format in which every line is one complete JSON document, so each record can be parsed as soon as it arrives.
- log field — One named value inside a structured log record, such as order_id or event.
- event name — A fixed identifier for the kind of thing a log record describes, such as order_accepted, that never changes with the wording.
Taught in
- Observability: Logs, Metrics, Traces — Modern API Architecture: REST, GraphQL & gRPC
- Observability with CloudWatch — Cloud Infrastructure & Hyperscaler Architecture
- Disposability, Dev Prod Parity And Logs — DevOps & Site Reliability Engineering
- The ASP.NET Core Middleware Pipeline — Modern .NET Core, C# & Enterprise Microservices
- Global Exception Handling and Problem Details — Modern .NET Core, C# & Enterprise Microservices
- Structured Logging & Correlation IDs: Context Stitching — Production Full-Stack Engineering
- Routing & Middleware: Path Parsing & Async Context — Node.js Internals & Backend Services
- Structured Logging And Why Text Fails — Full-Stack Observability: Metrics, Tracing & Logging
- OpenTelemetry: The Vendor Neutral Path — Full-Stack Observability: Metrics, Tracing & Logging
- Instrumenting A Service With Client Libraries — Full-Stack Observability: Metrics, Tracing & Logging
- Bringing The Three Signals Together — Full-Stack Observability: Metrics, Tracing & Logging
- A Worked Example Postmortem — Full-Stack Observability: Metrics, Tracing & Logging