AGENT SKILL

logfile-analyzer

Parse and analyze application logs — extract error patterns, frequency, timelines, and actionable insights.

License 许可
MIT
最近更新
2026-08-23
Stars
★ 1
Forks
0

01 前言 Front Matter

description
Parse and analyze application logs — extract error patterns, frequency, timelines, and actionable insights.

02 资源文件 1

03 SKILL.md 正文

Log Analyzer

Parse and summarize application logs to find errors, patterns, and anomalies.

Use when analyzing log files, debugging errors, or summarizing system events.

Requirements

  • Standard Unix tools: grep, awk, sort, uniq
  • Optional: jq (for JSON logs)
  • No API keys needed

Instructions

  1. Get log source — common locations:

    # System logs
    /var/log/syslog
    /var/log/auth.log
    journalctl -u <service> --since "1 hour ago" --no-pager
    
    # Web servers
    /var/log/nginx/error.log
    /var/log/nginx/access.log
    
    # Docker
    docker logs --since 1h <container> 2>&1
    
    # Application logs
    # Ask user for path
    
  2. Quick analysis — run these in sequence:

    # File overview
    wc -l logfile
    head -1 logfile && tail -1 logfile   # time range
    
    # Error counts by level
    grep -ciE '(error|fatal|critical)' logfile
    grep -ciE '(warn|warning)' logfile
    
    # Top error patterns (deduplicated)
    grep -iE '(error|exception|fatal)' logfile | \
      sed 's/[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}[T ][0-9:.]*//g' | \
      sed 's/\[.*\]//g' | sort | uniq -c | sort -rn | head -20
    
    # Error timeline (per hour)
    grep -iE '(error|fatal)' logfile | \
      grep -oE '[0-9]{4}-[0-9]{2}-[0-9]{2}[T ][0-9]{2}' | \
      sort | uniq -c
    
    # Recent errors with context
    grep -iE '(error|exception|fatal)' logfile | tail -30
    
  3. JSON logs (structured logging):

    cat logfile | jq -r 'select(.level == "error") | .message' | sort | uniq -c | sort -rn
    cat logfile | jq -r 'select(.level == "error") | .timestamp' | head -5  # first errors
    
  4. Output format:

    ? Log Analysis — filename.log (42,531 lines)
    Time range: 2025-01-15 00:00 → 2025-01-15 14:30
    
    ## Summary
    | Level | Count | % |
    |-------|-------|---|
    | ERROR | 67 | 0.16% |
    | WARN | 234 | 0.55% |
    | INFO | 42,230 | 99.3% |
    
    ## Top Errors
    | Count | Error Pattern |
    |-------|--------------|
    | 42 | Connection refused to db:5432 |
    | 18 | TimeoutError: request exceeded 30s |
    | 7 | OutOfMemoryError: heap space |
    
    ## Error Timeline
    | Hour | Errors | |
    |------|--------|-|
    | 14:00 | 3 | ▪ |
    | 15:00 | 47 | ▪▪▪▪▪▪▪▪▪▪▪▪▪ ⚠️ Spike |
    | 16:00 | 5 | ▪▪ |
    
    ## ? Recommendations
    - [ ] Check database connectivity (42 connection refused errors)
    - [ ] Review timeout settings (18 timeouts at 30s)
    - [ ] Increase JVM heap size (7 OOM errors)
    

Edge Cases

  • Large files (>100MB): Use tail -n 10000 or --since filtering first. Never read entire file into memory.
  • Non-standard log format: Ask user about the timestamp and level format, then adapt grep patterns.
  • Binary/compressed logs: zgrep for .gz files, journalctl for systemd binary logs.
  • Multi-line stack traces: Use grep -A 5 to capture context lines after errors.
  • No timestamps: Fall back to line-number-based analysis.

Real-time Monitoring

For live monitoring, suggest:

tail -f logfile | grep --line-buffered -iE '(error|fatal)'

Security Considerations

  • Log files may contain sensitive data (IPs, emails, tokens). Redact before sharing analysis.
  • Don't pipe log contents to external services.

04 同仓库更多 Skills

kbarbel640-del
kbarbel640-del/skills

crowd-prompting

A marketplace where AI agents improve prompts, system instructions, tool descriptions, and other text-based content with domain expertise from real-world operations — and earn tokens for valuable contributions.

内容创作者
★ 1
kbarbel640-del
kbarbel640-del/skills

dilemm-ai

Compete in DilemmAI, the prisoner's dilemma AI arena at dilemm.ai. Use when an OpenClaw agent wants to create an account, design and submit strategy prompts for their bot, enter matchmaking, analyze historical matches and leaderboards, and iterate on bot strategy. Requires headless browser automation (no API available yet).

Skill与智能体开发
★ 1
kbarbel640-del
kbarbel640-del/skills

arxiv-paper-reviews

Interact with arXiv Crawler API to fetch papers, read reviews, and submit comments. Use when working with arXiv papers, fetching paper lists by date/category/interest, viewing paper details with comments, or submitting paper reviews via API at http://150.158.152.82:8000.

资料检索与研究
★ 1
kbarbel640-del
kbarbel640-del/skills

arxiv-paper-reviews

Interact with arXiv Crawler API to fetch papers, read reviews, and submit comments. Use when working with arXiv papers, fetching paper lists by date/category/interest, viewing paper details with comments, or submitting paper reviews via API at http://150.158.152.82:8000.

资料检索与研究
★ 1
kbarbel640-del
kbarbel640-del/skills

git-summary

Get a quick summary of the current Git repository including status, recent commits, branches, and contributors.

★ 1
kbarbel640-del
kbarbel640-del/skills

agent-constitution

Interact with AgentConstitution governance contracts on Base Sepolia. Check compliance, read rules, log actions, query governance state.

律师与法务Skill与智能体开发
★ 1