All labs
Lab 57
Observability

Structured Logging & Correlation IDs

Plain logs from five services interleave into noise โ€” impossible to follow one request. Switch on structured logs with a shared trace id, filter to one id, and the request's whole journey across services reconstructs itself.

Two requests are running at the same time โ€” a booking (A) and a report download (B). Toggle structured logging and try to follow just one of them.
Log stream
00:00:00 POST /book received
00:00:00 GET /report received
00:00:00 token validated (alice)
00:00:00 token validated (bob)
00:00:00 creating booking #88213
00:00:00 fetching report #5521
00:00:00 charge timed out after 8s
00:00:00 report ready
00:00:00 fallback: pending payment
00:00:00 200 OK
๐ŸŒ€ No ids, two requests mixed together โ€” which 'timed out' line belongs to the booking? You can't tell. This is most logging.
What just happened