Infrastructure alerts are useful because they tell us that something may be wrong. The real challenge begins after the alert arrives, when an engineer has to decide whether it is important, what systems are affected and what should be investigated first.
After experimenting with AI-assisted log analysis, I started thinking about a broader operational problem. Logs are only one part of an incident.
An engineer may also need to review monitoring alerts, CPU and memory metrics, recent deployments, Kubernetes events, service health and network connectivity.
In this article, I will explore how AI can be used as an incident triage assistant that brings multiple operational signals together and converts them into a structured incident summary.
The goal is not to let AI automatically fix infrastructure. The goal is to help engineers understand an incident faster and decide what to investigate next.
Incident Triage Flow
Infrastructure Alert
↓
Collect Metrics + Logs + Events + Recent Changes
↓
Normalise and Correlate Evidence
↓
AI Assisted Analysis
↓
Incident Summary + Severity + Possible Causes
↓
Recommended Diagnostic Checks
↓
Engineer Reviews and Decides
Why Incident Triage Is Difficult
A monitoring platform may send an alert such as:
Alert: API error rate exceeded 10% for five minutes.
This tells us what threshold was crossed, but it does not tell us why.
The engineer may then need to check:
Application logs
Kubernetes pod health
CPU and memory utilisation
Database connectivity
Recent deployments
Network errors
Dependency availability
The challenge is not only collecting information. It is deciding which signals may be related.
A Simple Incident Scenario
Imagine a production API begins returning HTTP 500 errors.
At approximately the same time:
API error rate increases
Database latency increases
One application pod restarts
A new application version was deployed 12 minutes earlier
CPU utilisation remains normal
Looking at each signal individually may not provide enough context.
Alert
↓
API Errors
+
Database Latency
+
Pod Restart
+
Recent Deployment
↓
Possible Related Incident
Defining the Incident Data Model
Before involving AI, I prefer representing operational information in a structured form.
A Python dictionary can represent the incident:
incident = {
"alert": {
"name": "High API Error Rate",
"severity": "critical",
"value": "14.2%"
},
"metrics": {
"cpu_percent": 42.5,
"memory_percent": 68.1,
"database_latency_ms": 4200
},
"kubernetes": {
"pod_restarts": 1,
"ready_pods": 2,
"desired_pods": 3
},
"deployment": {
"version": "1.4.2",
"minutes_ago": 12
},
"service_health": {
"api": "DEGRADED",
"database": "SLOW"
}
}Structured data gives the analysis process a clear input.
It also becomes easier to add or remove operational signals later.
Start with Deterministic Rules
I do not want AI to be responsible for every decision.
Some incident signals are better handled through predictable rules.
For example:
def calculate_base_severity(incident):
alert_severity = incident["alert"]["severity"]
if alert_severity == "critical":
return "HIGH"
if alert_severity == "warning":
return "MEDIUM"
return "LOW"This behaviour is predictable.
AI can then add context around that known severity rather than replacing it.
Detecting Important Correlations
We can also perform simple correlation before sending anything to AI.
For example, if an application was deployed shortly before an incident, that information may be relevant.
def find_correlations(incident):
correlations = []
deployment = incident["deployment"]
if deployment["minutes_ago"] <= 15:
correlations.append(
"A deployment occurred within "
"15 minutes of the alert."
)
metrics = incident["metrics"]
if metrics["database_latency_ms"] > 3000:
correlations.append(
"Database latency is significantly elevated."
)
kubernetes = incident["kubernetes"]
if kubernetes["pod_restarts"] > 0:
correlations.append(
"At least one application pod restarted."
)
return correlationsThis gives us evidence that is already organised before AI analysis begins.
Building the Incident Context
I can now create a structured context object.
def build_incident_context(incident):
return {
"base_severity": calculate_base_severity(
incident
),
"correlations": find_correlations(
incident
),
"alert": incident["alert"],
"metrics": incident["metrics"],
"kubernetes": incident["kubernetes"],
"deployment": incident["deployment"],
"service_health": incident["service_health"]
}The benefit of this approach is that the AI does not receive a random collection of raw information.
It receives a clear operational context.
Adding Relevant Logs
Logs are still useful, but I prefer adding only the most relevant entries.
For example:
relevant_logs = [
"WARN Database latency 3800ms",
"ERROR Database connection timeout",
"ERROR Request /api/orders returned 500",
"WARN Kubernetes readiness probe failed",
"INFO Pod cloud-api-7f8 restarted"
]These can be added to the incident context after any required redaction.
Building the AI Triage Prompt
The prompt should clearly explain what the AI is allowed to do.
import json
def build_triage_prompt(context, logs):
incident_json = json.dumps(
context,
indent=2
)
log_text = "\n".join(logs)
return f"""
You are assisting a DevOps engineer
with incident triage.
Use only the evidence provided.
Return:
1. Incident summary
2. Operational impact
3. Important correlations
4. Possible causes
5. Recommended diagnostic checks
6. Confidence level
Rules:
- Do not claim a root cause unless
the evidence confirms it.
- Separate facts from assumptions.
- Do not execute or recommend
destructive actions.
- Do not restart, delete or modify
infrastructure automatically.
- The engineer remains responsible
for operational decisions.
Incident context:
{incident_json}
Relevant logs:
{log_text}
"""This keeps the model focused on triage rather than remediation.

Join the conversation! Your thoughts help the community grow.