Centralized Logging, Not Instance Files
coreintermediateA log file on a server only exists while that server does. On AWS, instances are replaced by an Auto Scaling group, containers are stopped and rescheduled, and Lambda execution environments disappear — so the logs of the failure that caused the replacement disappear with it. Centralized logging means the application writes to standard output or to an agent, and something else ships those events off the host as they are produced.
Think of it as
Logs on the instance are notes written on the whiteboard of a room you are about to demolish. Centralized logging is the habit of photographing the whiteboard continuously, so the notes survive the demolition — which, in an Auto Scaling group, is scheduled rather than hypothetical.
What we're doing: Understand why an Auto Scaling group hides the very failures it is replacing instances for.
- 1
- The information needed exists, on disk, for about two minutes.
- 5
- Instance replacement is the ASG working correctly. The logging design, not the scaling design, is what turned a self-healing event into an unexplainable one.
Why this works: Automatic replacement is the whole point of an Auto Scaling group, and it is fundamentally incompatible with logs that live on the instance. The two decisions have to be made together: anything that replaces compute automatically needs logs that leave the compute immediately.
Relying on SSH to read logs during an incident
Wrong
Better
What you see: During an incident the on-call is guessing which of forty instances served the failing requests, and the one that did has already been replaced.
Why: Reading logs by host requires knowing which host, which is exactly what you do not know during an incident spread across a fleet. Centralized logs are indexed by time and service, which matches how the question is actually asked.
- Local files
- Destroyed when the instance is replaced
- Readable only by someone who can log in
- One host at a time, no cross-fleet query
- Fills the disk, which itself causes outages
- Centralized
- Survives the instance that produced it
- Read through IAM, not SSH
- One query across every task in the service
- Retention and cost are configured, not accidental
Remember: Compute on AWS is replaced automatically, so logs that live on it are destroyed by normal operation. Write to stdout or to an agent, ship every event off the host as it is produced, and read logs through a log group query rather than by logging into a machine.
See also: aws log sources and retention · cloudwatch logs metric filters and insights

