Skip to content

Introduction

Intelligent Kafka log analysis with Claude Code — anomaly detection, priority classification, and actionable recommendations.

The Problem

Traditional Kafka debugging requires manual log grepping:

bash
grep ERROR server.log | wc -l
# → 156 errors, but what's the pattern?

Questions it can't answer:

  • Which errors are critical vs noise?
  • What's the timeline of the incident?
  • What actions should I take?
  • How do I share findings with my team?

The Solution

Kafka Log Analyzer provides intelligent analysis through three layers:

LayerCapabilityOutput
Log ParsingExtract events from Kafka logs11 event types + metadata
Anomaly Detection7 built-in detectorsPrioritized findings (P0-P3)
Report GenerationMultiple formatsMarkdown, JSON, Slack-ready

Key Features

📊 Intelligent Log Analysis

  • Multi-format — Parse text and JSON Kafka logs
  • 11 Event Types — send_success, send_failure, consumer_lag, rebalance, etc.
  • 7 Anomaly Detectors — error spikes, rebalance storms, lag spikes, leader instability, replica lag, serialization issues, network problems

🎯 Priority Classification

Automatic severity grading:

PrioritySeverityExample
🟢 P0 (Critical)Cluster downComplete broker failure
🟡 P1 (High)High lagConsumer lag > 10K messages
🟠 P2 (Medium)Transient issuesLeader changes, temporary errors
🔴 P3 (Low)WarningsConfiguration warnings, debug logs

🔄 Multiple Output Formats

  • Markdown — Detailed report with sections and recommendations
  • JSON — Structured data for programmatic processing
  • Slack — Compact format optimized for team channels

🖥️ Claude Code Integration

In Claude Code, use natural language commands:

CommandPurpose
/kafka-analyzeAnalyze logs and detect anomalies

Example Output

/kafka-analyze --source file --path server.log

📊 Analyzing server.log...

📋 Summary:
  Total Events: 847
  P0 (Critical): 3
  P1 (High): 12

⚠️ Anomalies:
  🔴 send_failure_spike (P0)
     → Error rate 15% exceeds threshold (5%)
     → Check broker availability and network connectivity

  🟠 consumer_lag (P1)
     → Consumer group order-processor lag: 15,000 messages
     → Consider scaling consumer instances

💡 Recommendations:
  1. Check broker availability
  2. Review consumer group configuration

Comparison

Dimensiongrep/awkKafka Log Analyzer
OutputRaw text linesStructured Event[] + anomalies
Anomalies❌ Manual spotting✅ 7 built-in detectors
Priority❌ No✅ P0-P3 automatic grading
Timeline❌ No✅ Time-window distribution
Recommendations❌ No✅ Actionable fix suggestions

Get Started

Choose your path:

bash
# Plugin marketplace
/plugin marketplace add saqqdy/kafka-log-analyzer
/plugin install kafka-log-analyzer

2. CLI (Zero-Install)

bash
npx kafka-log-analyze --source file --path server.log

3. Clone & Explore

bash
git clone https://github.com/saqqdy/kafka-log-analyzer.git
cd kafka-log-analyzer
pnpm install
pnpm run build
node dist/cli.js --source file --path tests/fixtures/sample-kafka-log.txt

Project Status

VersionThemeStatus
v0.1.0Core analysis engine✅ Released
v0.3.0Prometheus integration📋 Planned
v0.4.0Alert dispatch📋 Planned
v1.0.0Production-ready📋 Planned

See Roadmap for details.

License

MIT — use freely in personal and commercial projects.

Released under the MIT License.