Security
Skill
/log-analyzer
智能日志分析工具,帮助快速定位应用错误和性能瓶颈
Install
$ npx -y skills add huifer/skill-security-scan --skill log-analyzer --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/log-analyzer
Context preview
The summary Claude sees to decide when to auto-load this skill.
智能日志分析工具,帮助快速定位应用错误和性能瓶颈
SKILL.md
log-analyzer.SKILL.mdname: "Log Analyzer" description: "智能日志分析工具,帮助快速定位应用错误和性能瓶颈" author: "WellAlly Tech" version: "1.0.0"
Log Analyzer - 日志分析工具
功能描述
这是一个安全可靠的日志分析 Skill,用于帮助开发者快速分析和理解应用日志文件。
主要功能
1. **错误识别** - 自动识别日志中的错误和异常 2. **性能分析** - 检测慢查询和性能瓶颈 3. **统计报告** - 生成错误统计和趋势分析 4. **模式匹配** - 根据自定义规则搜索日志模式
使用场景
- 分析应用错误日志
- 监控系统性能指标
- 调试生产环境问题
- 审计安全事件
使用方法
当用户要求分析日志时:
1. 识别日志文件
查找并读取以下位置的日志文件:
- `./logs/*.log`
- `./var/log/*.log`
- 用户指定的日志文件路径
2. 分析日志内容
# 读取日志文件内容 # 使用正则表达式匹配错误模式: # - ERROR, WARN, CRITICAL # - Exception, Traceback # - HTTP 错误码(4xx, 5xx)
3. 生成分析报告
- 错误总数统计
- 错误类型分布
- 时间范围分析
- Top 错误排行
4. 输出结果
以清晰的 Markdown 格式输出分析结果,包括:
- 执行摘要
- 详细错误列表
- 改进建议
安全说明
- ✅ 只读取日志文件,不修改任何文件
- ✅ 不执行任何系统命令
- ✅ 不访问网络资源
- ✅ 不读取敏感配置文件
依赖项
- Python 3.9+
- 标准库:re, datetime, collections
示例用法
用户:分析当前目录的 application.log 工具:[分析日志内容] 输出:✅ 发现 23 个错误,主要是数据库连接超时
限制
- 仅支持文本格式日志
- 最大支持 100MB 的日志文件
- 不处理二进制日志
最佳实践
1. 定期清理旧日志文件 2. 使用结构化日志格式(JSON) 3. 在生产环境启用日志轮转 4. 保护敏感日志文件权限
---
版本历史
- v1.0.0 (2024-12-29) - 初始版本

