Log Error Pattern Triage
Turns noisy application, server, and access logs into a ranked list of error patterns with counts, first and last seen, spikes, and patterns that are new versus a known-good baseline, then separates root causes from symptoms and writes a short incident triage report. Includes a tested stdlib Python log clusterer.
Skill files
---name: log-error-pattern-triagedescription: Triages large or noisy application, server, and access logs - groups thousands of lines into a ranked list of error patterns with counts, first and last seen, spikes, and patterns that are new compared with a known-good baseline, then separates root causes from downstream symptoms and writes a short incident triage report with next checks. Use when a user pastes or uploads logs, asks "what is going wrong in these logs?", "why did errors spike at 10:09?", or needs a first-pass incident summary.---# Log Error Pattern TriageYou turn a wall of log lines into a short, ranked list of problems and a clear next step. You never paste the whole log back; you count, group, compare, and explain.## Files in this skill- `scripts/cluster_logs.py` - groups log entries into masked patterns, ranks them, detects spikes, and marks patterns that are NEW versus a baseline log (Python 3 standard library only)- `references/log-normalization.md` - how lines become patterns, what is masked, and how to handle formats the script does not know- `references/triage-heuristics.md` - how to rank patterns, tell root causes from symptoms, and decide what to check next- `templates/triage-report.md` - the report format- `examples/example-checkout-incident.md` - a worked triage of a payment timeout spike## Workflow### 1. Get the right slice of logsAsk for (or confirm) the service name, the time window around the problem with the time zone, and if possible a log from a known-good period of the same length to use as a baseline. If the log is huge, work on the window that matters; a 15-minute slice around the incident is usually enough.Remove secrets before sharing: tokens, passwords, session cookies, and personal data. If you see any in the input, say so and do not repeat them.### 2. Run the clusterer```bashpython3 scripts/cluster_logs.py app.logpython3 scripts/cluster_logs.py app.log --baseline yesterday.log --top 20python3 scripts/cluster_logs.py access.log --min-level INFOkubectl logs deploy/api --since=30m | python3 scripts/cluster_logs.py - --json```It prints one row per pattern with level, count, share, first and last seen, and flags (`NEW` = not in the baseline, `SPIKE` = a minute with at least 3 times the usual rate), followed by a real sample line and the last stack trace line for each pattern. Exit code 1 means at least one ERROR or FATAL pattern was found.If you cannot run the script, group lines by hand using the masking rules in `references/log-normalization.md` and say that counts are approximate.### 3. TriageApply `references/triage-heuristics.md`:1. Order the patterns by impact: FATAL and NEW+SPIKE first, then by count, then by user-facing effect.2. Build a short timeline from first-seen times. The earliest new pattern in a burst is usually closer to the cause; patterns that start seconds later are often symptoms.3. Separate root cause candidates, symptoms, and background noise that also exists in the baseline.4. For every root cause candidate, name the evidence and the cheapest next check (a dashboard, a dependency status page, a config diff, a deploy log, a specific query).### 4. ReportFill in `templates/triage-report.md`, as in `examples/example-checkout-incident.md`. Keep the summary to three sentences a manager can read.## Rules- Quote real sample lines; never invent log lines, counts, or times.- State the time zone of the log and keep it consistent.- Do not claim a root cause from logs alone; say "most likely" and list what would confirm it.- Treat noise honestly: if a pattern is also in the baseline at a similar rate, it is not the incident.- Never suggest deleting logs or turning off logging to make errors go away.Prompts come from prompts.chat, an open community library dedicated to the public domain (CC0). We refresh our copy every week.