What are good logging practices for a distributed system?
What they are really testing: Whether you know structured logging, levels, correlation IDs, and centralization, and that over-logging and logging secrets are real problems. Logs are where cost and usefulness collide.
A real interview question
What are good logging practices for a distributed system?
What most people say
drag me
“I would log important events and errors so I can look at them later.”
It misses everything that makes logs usable at scale: structure for querying, correlation IDs to trace a request across services, centralization, and the discipline of not logging secrets or drowning in noise.
The follow-ups they ask next
Why are correlation IDs essential in microservices?
A single user request touches many services; a shared correlation/trace ID on every log line lets you reconstruct the full path of that one request across services, which is otherwise nearly impossible to piece together.
What is the risk of over-logging?
Cost (storage/indexing) and noise that buries the signal, so real issues are harder to find. Use levels deliberately and log what is actionable, not everything.
What the interviewer is listening for
- Structured logging + levels
- Correlation/trace IDs across services
- Centralized + no secrets/PII + retention
What sinks the answer
- Just "log errors"
- No correlation IDs
- Unaware of cost/secrets concerns
If you genuinely do not know
Say this instead of freezing. Reasoning out loud from what you do know beats silence every single time, and a good interviewer is listening for exactly that.
“Good logging: [structured (JSON, consistent fields) for querying], [deliberate levels and no over-logging, noise/cost], [a correlation/trace ID on every line to follow one request across services], and [centralize to ELK/Loki with retention, never log secrets/PII].”
Keep going with observability
Foundation
What is the difference between monitoring and observability?
Foundation
What are the three pillars of observability, and what is each good for?
Foundation
What should you measure first for a service? Explain the golden signals (or RED/USE).
Junior
What are the main metric types (counter, gauge, histogram), and when do you use each?
Junior
What is distributed tracing, and how does it work?
Junior
How does Prometheus collect metrics, and what is the pull model?
Knowing the answer is not the same as recalling it under pressure
Sign in to send the questions you fumble to spaced recall, so they come back right before you would forget them, and learn the concepts behind them with hands-on labs.
Start free