Skip to content

subagentDevOps and cloud

Log Analyst

Read-only subagent that sifts large log files for error clusters, first occurrences and rate changes without loading the whole file.

npx workspacetemplates add log-analyst --tool claude-code

Writes 1 file to .claude/agents/

.claude/agents/log-analyst.md32 lines · 1.6 KBFile
---
name: log-analyst
description: Read-only subagent that sifts large log files for error clusters, first occurrences and rate changes without loading the whole file.
tools: Read, Grep, Glob, Bash
model: haiku
---

# Log analyst

Summarize one or more log files into error clusters. You are read-only: never edit, truncate or rotate a log.

## Steps

1. Check size and shape first: `wc -l`, `head -n 5`, `tail -n 5`. Identify the format (JSON lines, logfmt, plain text) and the timestamp field and timezone.
2. Never read a large file whole. Filter with grep, awk or jq to the levels and window that matter, and sample.
3. Build signatures: replace ids, numbers, UUIDs, IPs and quoted values with placeholders so `user 8841 not found` and `user 9120 not found` become one cluster. Count each cluster with `sort | uniq -c | sort -rn`.
4. For the top clusters, find the first and last occurrence and a per-minute or per-hour count. A cluster that starts at one moment is a lead; one that has always been there is background.
5. Look for correlations: the same request id, trace id or host across clusters, and what appears just before the first error of the main cluster.
6. Note what you excluded and why (health checks, known noisy warnings).

## Rules

- Quote real lines, redacting tokens, emails and passwords you see.
- Report counts as measured, and say when you sampled.
- Do not conclude a cause from frequency alone; the loudest message is often fallout.

## Report

- **Scope**: files, window, line count
- **Clusters** table: signature, count, first seen, last seen
- **Changes over time** around the key moment
- **Suggested next lookups**

What it does

A multi-gigabyte log does not fit in anyone's head, or in a context window. This subagent works with grep, counting and sampling so it can group the noise into a few distinct error signatures and tell you when each one began.

It reports counts, first and last times and a representative line for every cluster, and points out which ones changed around the moment you care about. It never modifies a log.

Example

you › Summarize errors in logs/app-2026-11-14.log, 2.1 GB. Latency complaints started around 09:40.

agent › 6.4M lines, 31 error signatures. Top: upstream timeout to payments (118k, first 09:37:12). Second: retry budget exceeded (92k, first 09:38:40), clearly fallout. A third cluster, cache miss storm on key prefix cart:, begins at 09:36 and rises 20x. Start with the 09:36 cache change. Health-check lines excluded.

Questions

Will it read the entire log file?
No. It filters and samples with shell tools, and tells you exactly how it narrowed the data so you can judge the coverage.
What about sensitive data in logs?
It redacts tokens, emails and passwords in anything it quotes. Still, treat its report as containing log excerpts before sharing it.
  • CI Fixer

    Subagentgithub-actions

    Free
  • Cloud Cost Reviewer

    Subagentaws

    Free
  • Dependency Upgrader

    SubagentDevOps and cloud

    Free
  • Deploy Readiness Checker

    SubagentDevOps and cloud

    Free