IT lexicon › Infra & Ops › Structured logging

Structured logging

Infra & Ops På svenska → Updated: 2026-11-14

Logs formatted as data (JSON, protobuf) instead of free text — enabling efficient indexing and queries without regex parsing.

A classic log is plain text: ERROR: Connection timeout after 30s to db.example.com:5432. A parser might miss details or misinterpret. Structured logging writes it as {"level":"ERROR","message":"Connection timeout","host":"db.example.com","port":5432,"duration_ms":30000}. A log aggregator can now group by "all timeouts to this host" or create alerting rules without fragile regex.

The tradeoff: more bytes per log entry (JSON wrapper), but offset by better aggregation and less manual parsing. Most modern app frameworks and logging libraries (Winston, Pino, structlog, Zap) support this as a default or first-class citizen.

← Back to the lexicon