We use analytics cookies.We use cookies to analyze site traffic and improve your experience.
Loading...
This idea carries a full system design question on its own. Each walks through the full answer.
System Design Masterclass · Observability Monitoring
Free preview: the first 2 parts of this 7-part lesson.
Already bought the course? Sign in to read the whole lesson.
this lesson is part of
System Design Masterclass
Unlock this lesson and the 751 other paid lessons
$25 once, by PayPal
See the System Design courseread the rest of this lesson in
System Design Masterclass
Unlock this lesson and the 751 other paid lessons
$25 once, by PayPal
See the System Design coursein Observability Monitoring
This lesson is part of the full System Design Masterclass. Unlock it along with 769 other lessons for a one-time payment.
One-time payment by card or PayPal
Get Lifetime AccessOne-time payment: UPI, card or netbanking
Get Lifetime Access18 Foundation lessons are free, no payment needed. Try them now
It is easy and good
“It is really nice and good Please join the course”
An operations team had a monitoring rule that parsed log lines using a regex to extract response times. It worked perfectly, until a developer changed the log format slightly. The log used to say Response time: 234ms and now it said response_time=234ms. The regex broke silently. For three days, the dashboard showed nothing while production response times climbed to 5 seconds.
Unstructured logs, free-form text strings, are a liability at scale. They look fine when you're reading them manually. But the moment you try to parse, search, filter, or aggregate them programmatically, you're building on quicksand. Every log format change, every developer's personal style preference, every service's slightly different timestamp format becomes a parsing landmine.
Structured logging means emitting logs as key-value data (usually JSON) instead of human-readable strings. The machine doesn't have to guess where the response time is, it's in a field called response_time_ms with a numeric value.
Unstructured (text):
[2026-04-04 10:30:12.456] INFO PaymentService - Processing payment for user alice@example.com, order #8834, amount $49.99, gateway=stripe
Structured (JSON):
{
"timestamp": "2026-04-04T10:30:12.456Z",
"level": "INFO",
"service": "payment-service",
"message": "Processing payment",
"user_email": "alice@example.com",
"order_id": 8834,
"amount": 49.99,
"currency": "USD",
"gateway": "stripe",
"request_id": "req_abc123",
"trace_id": "trace_xyz789"
}
The structured version is longer, sure. But look at what you gain:
| Capability | Unstructured | Structured |
|---|---|---|
| Search by field | Regex (fragile) | Exact field query: order_id:8834 |
| Aggregate | Basically impossible | SELECT gateway, AVG(amount) GROUP BY gateway |
| Alert on values | Parse and hope | WHERE amount > 10000 AND gateway = "stripe" |
| Dashboards | Manual extraction | Automatic field detection |
| Cross-service correlation | Grep for text patterns | Join on request_id or trace_id |
Every modern log aggregation system (, Datadog, Splunk, Loki) works dramatically better with structured logs. They can auto-detect fields, build indexes, and let you slice and dice without writing a single regex.