ThisCalculator

Everyday

Cloud SRE Incident Investigation: Safe Steps

Updated · Standard formula, shown below

To investigate a cloud incident safely, a site reliability engineer (SRE) must first stabilize the situation by confirming the blast radius, preserving evidence, and avoiding any action that could worsen the outage or destroy logs. This article outlines a practical, safety-first investigation workflow that balances speed with caution, covering preparation, containment, evidence collection, and post-incident review.

Why Safety Matters in Incident Investigation

When a cloud service degrades or fails, the instinct is to jump straight into troubleshooting: check dashboards, tail logs, restart services. But hasty actions can turn a small issue into a full outage. For example, restarting a database instance that is already in a crash loop may trigger a failover that takes down a primary region. Similarly, running a diagnostic command that writes to the same disk that is filling up can push the system over the edge. Safety in this context means protecting the service, the data, and the team’s ability to learn from the incident.

A safe investigation also protects the SRE’s own access and the trust of stakeholders. Actions taken during an incident are often under intense scrutiny; a misstep that deletes logs or alters configuration can obscure the root cause and delay recovery. The goal is to gather enough information to form a working hypothesis, test it with minimal risk, and then act decisively—but only after the potential consequences are understood.

Before the Incident: Preparation and Runbooks

Safety starts long before the pager goes off. A well-prepared SRE team has:

  • Runbooks: Documented procedures for common incident types (e.g., database failover, network partition, memory leak). These include exact commands, expected outputs, and rollback steps.
  • Access controls: Role-based access with least privilege. During an incident, an SRE should only have permissions needed for investigation and mitigation, not full admin rights to every system.
  • Log aggregation: Centralized logging (e.g., ELK stack, Splunk) so that logs are available even if the originating server is down. This reduces the need to SSH into production hosts.
  • Chaos engineering drills: Regular simulations of incidents to practice safe investigation techniques and refine runbooks.

Without preparation, an SRE is forced to improvise under pressure, which increases the chance of a mistake. Runbooks should be tested and updated after each incident to reflect what was learned.

First Steps: Triage and Containment

The first 10 minutes of an incident are critical. The SRE should:

  1. Acknowledge the alert and check the incident response channel for any existing threads.
  2. Assess the blast radius: Which services, regions, or customers are affected? Is it a single instance or a regional failure?
  3. Contain the damage: If the issue is a bad deployment, roll back immediately. If it’s a traffic spike, scale out or enable rate limiting. Containment actions should be reversible and documented.
  4. Preserve evidence: Before making changes, capture the current state: process lists, network connections, disk usage, and recent logs. This is the baseline for later analysis.

Containment is not the same as fixing the root cause. It is about stopping the bleeding while keeping the system in a state that can be investigated. For example, if a new version of a microservice is crashing, the safe move is to roll back to the previous version—not to start editing code in production.

Gathering Evidence Without Making Things Worse

Once the incident is contained, the investigation can begin in earnest. The key principle is: read-only first, write-only when necessary. Use tools that do not modify the system:

  • Logs: Query centralized logs with time ranges that cover the start of the incident. Look for error messages, stack traces, and unusual patterns.
  • Metrics: Review dashboards for CPU, memory, latency, error rates, and saturation. Compare to the same time last week to identify anomalies.
  • Tracing: Use distributed tracing (e.g., Jaeger, Zipkin) to follow a single request through the system and pinpoint where it fails.
  • Status pages: Check cloud provider status pages for known outages that might explain the issue.

If you must run a command on a live server, prefer ones that are non-destructive: top, ps, netstat, df, curl (for health endpoints), and tail on logs. Avoid commands that write to disk (e.g., dd, scp large files) or that kill processes unless you are certain they are safe. Also, be mindful of the observer effect: even a simple top can add load to a struggling machine. Run commands sparingly and batch them.

Common Pitfalls and How to Avoid Them

Even experienced SREs fall into traps during incidents. Being aware of these can keep you safe:

  • Tunnel vision: Fixating on one hypothesis (e.g., “it’s a database issue”) while ignoring evidence that points elsewhere. Mitigation: periodically step back and ask “what else could cause this?”
  • Making changes without a rollback plan: Every action should have an undo. If you change a config, save the old one. If you restart a service, know how to restore the previous state.
  • Ignoring the human factor: The person who made the last deployment might be the one who knows what changed. Communicate with the team, not just with the system.
  • Not preserving evidence: Overwriting logs or closing terminal sessions can lose the very data needed for a postmortem. Always copy relevant logs to a safe location (e.g., a cloud storage bucket) before shutting anything down.
  • Acting on incomplete data: A single error log might be a red herring. Wait for corroborating evidence from metrics or traces before making a significant change.

Post-Incident Review and Learning

After the service is restored, the investigation is not over. The post-incident review (or postmortem) is where the real learning happens. A blameless postmortem focuses on systems and processes, not individuals. It should answer:

  • What was the root cause?
  • What contributed to the incident (e.g., missing alerts, weak testing)?
  • What was done well during the response?
  • What should change to prevent a recurrence?

Action items should be specific, owner-assigned, and tracked. For example, if the incident was caused by a misconfigured firewall, the action might be to add a validation step in the CI/CD pipeline. The postmortem document itself should be stored in a shared location so that the whole team can learn from it.

Frequently Asked Questions

Should I SSH into a production server during an incident?

Only if absolutely necessary and if you have the proper access. Prefer centralized logging and monitoring first. If you must SSH, use a bastion host and avoid running any commands that write to the local disk unless you are certain they are safe. Always record the session for later review.

How do I avoid making the incident worse when I’m under pressure?

Follow your runbook. If you don’t have a runbook, take a deep breath and list the potential side effects of any action before you take it. When in doubt, do nothing except observe—a few extra minutes of gathering data is usually safer than a hasty change.

What is the most important piece of evidence to preserve?

Logs from the affected service(s) covering the time window from just before the incident started to when it was contained. Also preserve configuration files and deployment manifests. These are often enough to identify the root cause.

Can I use a read-only replica to investigate without affecting production?

Yes, if your database has a read replica, you can run queries against it without impacting the primary. However, be aware that the replica may lag behind, so it might not reflect the exact state at the time of the incident. Use it for analysis, not for live debugging.

How do I know if a command is safe to run?

Check the man page or documentation, and ask a teammate if you’re unsure. A good rule of thumb: if a command can modify or delete data, it is not safe unless you have a specific reason to run it and a backup. Read-only commands like ps, df, and netstat are generally safe.

What should I do if I accidentally delete logs during an investigation?

Stop what you’re doing and inform the incident commander immediately. If you have a centralized log system, the logs may still be there. If not, you may have lost the evidence. This is why it’s critical to copy logs to a separate location early in the investigation.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.