moonlight-lupin/agent-skills / agent-ops/log-analyzer
log-analyzer
VerifiedUse when parsing agent log files to identify error patterns, rate limit hits, timeout clusters, tool failures, and component-level error counts. Produces a structured anomaly report. Cron-compatible — silent if no issues, alert digest if anomalies found.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 11.7 KB |
| references/anomaly-types.md | markdown | 4.3 KB |
| references/hermes-profile-audit.md | markdown | 3.9 KB |
| references/log-formats.md | markdown | 3.4 KB |
| references/state-failure-monitor.md | markdown | 4.5 KB |
| scripts/analyze_logs.pyexecutable | script | 23.1 KB |
| scripts/hermes_log_window.py | script | 4.2 KB |
| scripts/state_failures.pyexecutable | script | 8.8 KB |
| tests/test_analyze_logs.py | script | 8.1 KB |
| tests/test_state_failures.py | script | 9.0 KB |
references/log-formats.md
View on GitHub# Supported Log Formats
`analyze_logs.py` is built for common line-oriented logs with a timestamp, a log
level, an optional component, and a message. It also performs best-effort scans
of unstructured lines that contain obvious level words such as `ERROR` or
`WARN`.
## Contents
- Recognized Levels
- Full Timestamp with Bracketed Component
- ISO 8601 Timestamp with Colon Component
- Time-Only Lines
- Unstructured Fallback
- Multiline Stack Traces
- Adding Custom Patterns
## Recognized Levels
The parser recognizes these levels, case-insensitively when falling back to
unstructured parsing:
- `ERROR`
- `WARN`
- `WARNING`
- `INFO`
- `DEBUG`
- `FATAL`
- `CRITICAL`
`ERROR`, `FATAL`, and `CRITICAL` count as errors. `WARN` and `WARNING` count as
warnings.
## Full Timestamp with Bracketed Component
```text
2026-07-06 12:30:45 ERROR [gateway] Connection refused
2026-07-06 12:31:01 WARN [cron] job ran longer than expected
```
Shape:
```text
YYYY-MM-DD HH:MM:SS LEVEL [component] message
```
The component is the value inside brackets. If no component is present, the
component is recorded as `unknown`.
## ISO 8601 Timestamp with Colon Component
```text
2026-07-06T12:30:45Z ERROR gateway: Connection refused
2026-07-06T12:30:45+00:00 ERROR agent: unhandled exception
```
Shape:
```text
YYYY-MM-DDTHH:MM:SSZ LEVEL component: message
YYYY-MM-DDTHH:MM:SS+00:00 LEVEL component: message
```
The parser accepts `Z`, `+00:00`, and compact offsets such as `+0000`.
Parsed timestamps are normalized to UTC in JSON output.
## Time-Only Lines
```text
12:30:45 ERROR Connection refused
12:31:00 WARN [tools] retrying tool call
```
Shape:
```text
HH:MM:SS LEVEL [optional-component] message
```
Time-only lines do not contain a date. The command-line parser anchors them to
the current UTC date. If you import `parse_log_line()` from Python, pass a
`default_date` argument when parsing historical fixtures.
## Unstructured Fallback
```text
worker stderr: ERROR command failed with exit code 127
WARN retry budget almost exhausted
```
If a line does not match a timestamped format but contains a recognized level,
the parser records:
- `timestamp: null`
- `component: unknown`
- `level`: the matched level
- `message`: the text after the level
Unknown-timestamp lines are retained when `--since` is used, because the tool
cannot prove they are outside the window.
## Multiline Stack Traces
```text
2026-07-06 15:30:00 ERROR [agent] Traceback (most recent call last):
File "runner.py", line 12, in <module>
run()
KeyError: 'session_id'
```
Continuation lines are grouped under the preceding parsed line when they are
indented or look like common Python traceback frames/errors. The grouped entry
counts as one parsed log event, but `lines_analyzed` still includes the physical
line count.
## Adding Custom Patterns
To add another log format, edit `scripts/analyze_logs.py`:
1. Add a compiled regular expression near `ISO_LINE_RE`, `SPACE_LINE_RE`, and
`TIME_LINE_RE`. Use named groups: `ts`, `level`, optional `bracket` or
`colon`, and `message`.
2. Add the regex to the loop in `parse_log_line()`.
3. Extend `parse_timestamp()` if the new timestamp shape is not already
supported.
4. Add a pytest fixture in `tests/test_analyze_logs.py` that proves the parser
extracts timestamp, level, component, and message correctly.
Keep custom patterns conservative. Overly broad regexes can misclassify ordinary
application messages as log headers and break multiline stack trace grouping.Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation). | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK). | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |