360 Secure SkillHub
360 安全技能中心

Log Analyzer

该 Skill 通过随附的 Python 脚本分析任意文本日志文件,自动识别 FATAL/ERROR/WARN/INFO/DEBUG 级别,按指纹归并重复错误,标记错误率高于均值 2 倍的异常小时,支持 ISO 8601、syslog 与 nginx/apache 时间戳,并可输出文本报告或 JSON。

johnnywang2001
johnnywang2001
热度 82.16
最近更新 2026-05-11 17:30:07
分类:数据依赖:代码执行 / 读写文件应用场景:数据处理 / 报告撰写 / 调试排错 / DevOps

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add jrv-log-analyzer
Metadata
name
jrv-log-analyzer
description
Analyze log files to detect error patterns, aggregate by severity, group repeated errors by fingerprint, and flag anomaly time windows. Use when asked to analyze logs, find errors in log files, debug server issues from logs, summarize log output, or identify error spikes. Supports syslog, application logs, nginx/apache logs, and any text-based log format.

Log Analyzer

Analyze any text-based log file for error patterns, severity breakdown, and anomaly detection.

Quick Start

python3 scripts/analyze_logs.py <logfile>
python3 scripts/analyze_logs.py app.log --top 20 --severity ERROR
python3 scripts/analyze_logs.py server.log --json --since "2026-03-01"

Features

  • Severity classification — auto-detects FATAL, ERROR, WARN, INFO, DEBUG from log lines
  • Error fingerprinting — groups similar errors by stripping variable parts (IPs, UUIDs, PIDs, timestamps)
  • Anomaly detection — flags hours with error rates >2x the average
  • Timestamp parsing — handles ISO 8601, syslog, and nginx/apache formats
  • Flexible output — human-readable report or --json for piping

Options

Flag Description
--top N Number of top error patterns (default: 15)
--severity LEVEL Minimum severity filter (FATAL, ERROR, WARN, INFO, DEBUG)
--json Output structured JSON
--since TIMESTAMP Only analyze lines after this timestamp

Workflow

  1. Run the analyzer on the target log file
  2. Review severity breakdown for overall health
  3. Check top error patterns for recurring issues
  4. Look at anomaly hours for incident windows
  5. Use --json output to feed into other tools or reports