跳到正文
cccskills
免费在 GitHub 公开

multi-file-log-correlator

Correlate events across multiple log files from different sources, systems, or time periods. Build unified timelines, identify causal relationships between events, and highlight anomalies that span multiple data sources. Supports timezone normalization and gap detection. Use when analyzing logs from multiple systems (frontend, backend, database, infrastructure), investigating distributed system failures, or building event timelines across services. Triggers: "correlate these logs", "build timeline from multiple logs", "cross-system analysis", "find related events across logs", "multi-source log analysis", "distributed trace analysis"

中文简介正在准备中。当前显示原文说明。

查看安装方法

包含的文件(6)

  • SKILL.md6.7 KB
  • references/correlation_methodology.md6.5 KB
  • references/timestamp_formats.md6.1 KB
  • scripts/correlate_logs.py26.0 KB
  • scripts/tests/conftest.py241 B
  • scripts/tests/test_correlate_logs.py13.3 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Multi-File Log Correlator

Overview

This skill correlates events across multiple log files from different sources, systems, or time periods. It builds unified timelines, identifies causal relationships between events, and highlights anomalies that span multiple data sources. The skill handles timezone normalization, timestamp format differences, and gap detection to provide a comprehensive view of distributed system behavior.

Key Capabilities:

  • Unified timeline construction from heterogeneous log sources
  • Causal relationship inference between events across systems
  • Timezone normalization and timestamp alignment
  • Gap and anomaly detection across multiple data sources
  • Correlation ID tracking and distributed trace reconstruction

When to Use

  • Investigating incidents involving multiple services (frontend, API, database, cache)
  • Analyzing distributed system failures across microservices
  • Building event timelines from logs with different timestamp formats
  • Correlating infrastructure logs with application logs
  • Detecting timing anomalies between system components
  • Tracing request flows across multiple services
  • Post-mortem analysis requiring multi-source log correlation

Prerequisites

  • Python 3.9+
  • No API keys required
  • Dependencies: pandas, python-dateutil (for timezone handling)

Workflow

Step 1: Inventory Log Files

Identify all log files to correlate. Document their source system, timezone, and timestamp format.

# List available log files
ls -la /path/to/logs/

# Check first few lines to identify format
head -5 app.log nginx.log database.log

Step 2: Parse and Normalize Timestamps

Run the correlator with timezone and format configuration.

python3 scripts/correlate_logs.py \
  --logs app.log:app:UTC:"%Y-%m-%d %H:%M:%S" \
  --logs nginx.log:nginx:America/New_York:"%d/%b/%Y:%H:%M:%S %z" \
  --logs database.log:db:UTC:"%Y-%m-%dT%H:%M:%S.%fZ" \
  --output-tz UTC \
  --output timeline.json

Step 3: Build Unified Timeline

The script generates a merged, time-ordered event sequence with source attribution.

# View timeline summary
python3 scripts/correlate_logs.py \
  --logs app.log:app \
  --logs nginx.log:nginx \
  --summary

Step 4: Detect Correlations

Identify events that are causally related using correlation IDs, request IDs, or temporal proximity.

python3 scripts/correlate_logs.py \
  --logs app.log:app \
  --logs nginx.log:nginx \
  --correlation-field request_id \
  --time-window 5s \
  --output correlations.json

Step 5: Identify Gaps and Anomalies

Detect missing data periods and timing anomalies across sources.

python3 scripts/correlate_logs.py \
  --logs app.log:app \
  --logs nginx.log:nginx \
  --detect-gaps \
  --gap-threshold 60s \
  --output gaps_report.json

Step 6: Generate Correlation Report

Produce a comprehensive Markdown report with timeline visualization.

python3 scripts/correlate_logs.py \
  --logs app.log:app:UTC \
  --logs nginx.log:nginx:America/New_York \
  --logs database.log:db:UTC \
  --full-report \
  --output correlation_report.md

Output Format

JSON Timeline

{
  "schema_version": "1.0",
  "generated_at": "2025-01-15T10:30:00Z",
  "output_timezone": "UTC",
  "sources": [
    {
      "name": "app",
      "file": "app.log",
      "original_tz": "UTC",
      "events_count": 1523,
      "time_range": {
        "start": "2025-01-15T08:00:00Z",
        "end": "2025-01-15T10:00:00Z"
      }
    }
  ],
  "timeline": [
    {
      "timestamp": "2025-01-15T08:00:01.234Z",
      "source": "nginx",
      "level": "INFO",
      "message": "GET /api/users 200",
      "correlation_ids": ["req-abc123"]
    }
  ],
  "correlations": [
    {
      "correlation_id": "req-abc123",
      "events": [
        {"source": "nginx", "timestamp": "...", "message": "..."},
        {"source": "app", "timestamp": "...", "message": "..."},
        {"source": "db", "timestamp": "...", "message": "..."}
      ],
      "total_duration_ms": 245
    }
  ],
  "gaps": [
    {
      "source": "app",
      "gap_start": "2025-01-15T09:15:00Z",
      "gap_end": "2025-01-15T09:17:30Z",
      "duration_seconds": 150
    }
  ],
  "anomalies": [
    {
      "type": "timing_anomaly",
      "description": "Database response 500ms after app request (expected <100ms)",
      "events": ["..."]
    }
  ]
}

Markdown Report

The Markdown report includes:

  • Executive Summary: Key findings and correlation statistics
  • Source Inventory: List of log files with metadata
  • Unified Timeline: Time-ordered event listing with source attribution
  • Correlation Analysis: Grouped events by correlation ID
  • Gap Analysis: Missing data periods and coverage statistics
  • Anomaly Findings: Timing issues, sequence violations, unexpected patterns
  • Mermaid Sequence Diagram: Visual representation of cross-system flows

Resources

  • scripts/correlate_logs.py -- Main correlation engine with CLI interface
  • references/correlation_methodology.md -- Correlation techniques and best practices
  • references/timestamp_formats.md -- Common log timestamp formats reference

Key Principles

  1. Normalize Early: Convert all timestamps to a common timezone immediately
  2. Preserve Source Attribution: Every event must retain its origin system
  3. Handle Imperfect Data: Gracefully process logs with missing or malformed timestamps
  4. Detect Gaps Explicitly: Missing data is as important as present data
  5. Enable Filtering: Support time ranges, severity levels, and correlation ID filtering

Differences from log-debugger

Aspectlog-debuggermulti-file-log-correlator
FocusSingle-file RCA, error analysisMulti-file correlation, timeline building
Primary OutputRoot cause reportUnified timeline, correlation map
Key Feature5 Whys, Fishbone analysisCross-source correlation, gap detection
Use Case"Why did this error happen?""How did events flow across systems?"

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Track and update action item status from natural language updates like 'Seanのメールには返信しておいた' or 'Lu対応予定'. Integrates with daily-comms-ops workflow. Use when managing action items across communication channels.

中文简介正在准备中。当前显示原文说明。

takusaotome/claude-skills-library102026年10月5日 更新

AI活用提案の専門コンサルタントスキル。LLM・AIエージェントの活用事例知識を基に、業界別、部門別、シーン別に最適なAI導入提案を行います。システム化、業務改善、効率化を得意とし、具体的な活用事例、期待効果、導入ステップを含む実践的な提案を提供します。Use when proposing AI/LLM adoption strategies for specific industries, departments, or business scenarios.

中文简介正在准备中。当前显示原文说明。

takusaotome/claude-skills-library102026年10月5日 更新

Generate AI-powered BPO service proposals for Japanese companies in the US market. Use when creating outsourcing proposals with AI service menus, ROI estimation, implementation roadmaps, and bilingual (JA/EN) proposal documents for 在米日系企業向けAI実装.

中文简介正在准备中。当前显示原文说明。

takusaotome/claude-skills-library102026年10月5日 更新

AI(LLM)が生成した日本語テキストの「AI臭」を検出・診断し、人間らしい文章にリライトするスキル。 Use when: 「AIっぽい文章を直して」「人間らしくリライトして」「AI臭を消して」「この文章をもっと自然にして」 「テキストのAI感を減らして」「機械っぽさを取りたい」 "make this sound more human", "remove AI tone", "humanize this text", "detect if this is AI-generated". 6つのAI特有パターン(視覚的マーカー、単調なリズム、マニュアル的構成、非コミット姿勢、抽象語の濫用、 定型メタファー)を正規表現ベースで検出し、0-100のAI臭スコアを算出。3つの人間化技法 (バランスを崩す・客観を崩す・論理を崩す)でリライトを実行する。 Note: 検出スクリプトは日本語テキスト専用。英語テキストの場合はClaude自身がreferences/を参照して分析・リライトする。

中文简介正在准备中。当前显示原文说明。

takusaotome/claude-skills-library102026年10月5日 更新

Generate audit-ready internal control design documents from As-Is business process inventories. Produces control IDs, assertion mappings, procedures, SoD analysis, KPIs, materiality thresholds, and implementation roadmaps. Use when building internal controls for new audit engagements, SOX/J-SOX compliance, or process improvement initiatives.

中文简介正在准备中。当前显示原文说明。

takusaotome/claude-skills-library102026年10月5日 更新

Review audit-related documents (control design documents, bottleneck analyses, requirements definitions, etc.) for quality, scoring them 0-100 with a severity-rated findings list. Use when reviewing audit documents, checking control design quality, or verifying cross-document consistency. Supports documents governed by US GAAP, IFRS, or J-GAAP.

中文简介正在准备中。当前显示原文说明。

takusaotome/claude-skills-library102026年10月5日 更新

查看 takusaotome 的全部技能

报告此技能的问题