Why Centralized Logging
What you'll learn: Why distributed systems can't rely on local logs and need a unified logging approach.
The Problem with Local Logs
In traditional applications, developers SSH into a server and run tail -f /var/log/app.log to debug issues. This works fine when you have one or two servers. But modern cloud infrastructure doesn't work that way.
Imagine you're running a microservices application across 50 containers spread over 10 Kubernetes nodes. A user reports an error. Where do you look? Which container handled the request? If that container restarted due to a crash, its local logs are gone. You're essentially searching for a needle in a haystack while the haystack keeps moving.
Why Distributed Systems Break Local Logging
Ephemeral infrastructure means containers and VMs come and go. Logs stored locally vanish with them.
Multiple instances of the same service make correlation impossible. Did instance A or instance B fail?
No unified view forces you to jump between machines, piecing together a story from fragments.
Performance debugging becomes nearly impossible when you can't see how a request flows through five different services.
The Centralized Solution
Centralized logging collects logs from all sources into one searchable, persistent location. Think of it like surveillance cameras in a building—instead of checking each room individually, you have a security office with all feeds in one place.
With centralized logging, you can:
- Search across all services simultaneously
- Correlate logs by request ID or user session
- Retain logs even after infrastructure changes
- Analyze patterns and trends over time
Key Takeaway: In distributed systems, local logs are temporary, fragmented, and unmanageable at scale—centralized logging provides the unified, persistent visibility needed to understand system behavior and debug issues effectively.