mcpbeat Sign in

Log Analyzer Skill for Claude

日志分析助手 — 智能解析日志文件,识别异常模式,定位问题根因

617 tokens
context cost
the whole folder, loaded on every use
1
files
instructions only
0
copies elsewhere
how many repositories repackaged it
722
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/laolaoshiren/claude-code-skills-zh --skill log-analyzer

The instruction itself

6 sections, as written by the author

📋 log-analyzer — 日志分析助手

触发条件

当用户要求以下操作时激活此技能:

  • 分析应用日志文件(.log, .txt, journalctl 输出等)
  • 排查线上问题和异常
  • 从日志中提取统计信息
  • 生成日志分析报告

工作流程

1. 日志格式识别

自动检测日志格式:

  • 结构化: JSON logs, Logfmt
  • 常见格式: Nginx/Apache access log, Spring Boot, Django, Rails
  • 系统日志: syslog, journalctl, Windows Event Log
  • 自定义格式: 根据正则提取字段

2. 日志预处理

  • 按时间范围过滤(如「最近 1 小时」「今天」)
  • 按日志级别筛选(ERROR, WARN, INFO, DEBUG)
  • 按来源/模块/服务过滤
  • 去重和聚合相似错误

3. 异常模式检测

  • 错误聚类: 将相似错误归为一组,避免重复分析
  • 频率分析: 识别高频错误和突发异常
  • 时间关联: 发现错误是否与特定事件(部署、流量高峰)相关
  • 因果链追踪: 从根因错误到最终表现

4. 关键信息提取

  • 错误堆栈分析(定位源码位置)
  • HTTP 状态码分布(4xx/5xx 比例)
  • 响应时间统计(P50/P95/P99)
  • 内存/CPU 异常指标

5. 生成分析报告

## 📊 日志分析报告

### 概览
- 时间范围: 2024-01-15 10:00 ~ 12:00
- 总日志量: 12,847 条
- 错误数: 234 (1.8%)
- 警告数: 567 (4.4%)

### Top 5 异常
| 排名 | 错误类型 | 次数 | 首次出现 | 最近出现 |
|------|---------|------|---------|---------|
| 1 | NullPointerException | 89 | 10:15 | 11:42 |
| 2 | ConnectionTimeout | 67 | 10:23 | 11:58 |

### 根因分析
最可能的原因:数据库连接池耗尽(线索:连续出现 ConnectionTimeout 后跟大量 NullPointerException)

### 建议
1. 检查数据库连接池配置(当前可能 maxActive 太小)
2. 排查是否存在连接泄漏
3. 添加连接池监控告警

支持的日志来源

  • 文件系统日志(*.log)
  • Docker/Kubernetes 容器日志
  • journalctl 系统日志
  • AWS CloudWatch / GCP Logging
  • ELK Stack (Elasticsearch 查询结果)
  • 应用直接输出的文本

注意事项

  • 敏感信息脱敏(密码、token、手机号等)
  • 大文件分块处理,避免内存溢出
  • 时区统一处理
  • 不要臆造日志中不存在的信息

Other skills for the same job

different authors, same section of the catalogue
Protocolsio Integration
by christophacham
×4

Integration with protocols.io API for managing scientific protocols. This skill should be used when working with protocols.io to search, create, update, or publish protocols; manage protocol steps and materials; handle discussions and comments; organize workspaces; upload and manage files; or integrate protocols.io functionality into workflows. Applicable for protocol discovery, collaborative protocol development, experiment tracking, lab protocol management, and scientific documentation.

16k tokens
Tailored Resume Generator
by frostant
×4

Analyzes job descriptions and generates tailored resumes that highlight relevant experience, skills, and achievements to maximize interview chances

3k tokens
Excalidraw Diagram Generator
by github
vendor ×3

Generate Excalidraw diagrams from natural language descriptions. Use when asked to "create a diagram", "make a flowchart", "visualize a process", "draw a system architecture", "create a mind map", or "generate an Excalidraw file". Supports flowcharts, relationship diagrams, mind maps, and system architecture diagrams. Outputs .excalidraw JSON files that can be opened directly in Excalidraw.

36k tokens scripts
Expo Dev Client
by openai
vendor ×3

Build and distribute Expo development clients locally or via TestFlight

961 tokens
Executing Plans
by ZhanlinCui
×3

Use when you have a written implementation plan to execute in a separate session with review checkpoints

542 tokens
Anndata
by christophacham
×3

Data structure for annotated matrices in single-cell analysis. Use when working with .h5ad files or integrating with the scverse ecosystem. This is the data format skill—for analysis workflows use scanpy; for probabilistic models use scvi-tools; for population-scale queries use cellxgene-census.

16k tokens
Benchling Integration
by christophacham
×3

Benchling R&D platform integration. Access registry (DNA, proteins), inventory, ELN entries, workflows via API, build Benchling Apps, query Data Warehouse, for lab data management automation.

14k tokens
Biopython
by christophacham
×3

Comprehensive molecular biology toolkit. Use for sequence manipulation, file parsing (FASTA/GenBank/PDB), phylogenetics, and programmatic NCBI/PubMed access (Bio.Entrez). Best for batch processing, custom bioinformatics pipelines, BLAST automation. For quick lookups use gget; for multi-service integration use bioservices.

24k tokens

How to use it

Copy the folder

Take laolaoshiren/log-analyzer from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

The agent identifies a skill by the name field in its header. Two skills with the same name cannot sit side by side — one of them will be ignored.