DEV Community

Cover image for Building LogSum: A 3.3ms Log Analyzer with a Beautiful Terminal UI
Mustafa Yildiz
Mustafa Yildiz

Posted on

Building LogSum: A 3.3ms Log Analyzer with a Beautiful Terminal UI

LogSum Demo

I've just released LogSum v0.1.0, a fast log analyzer that can process 10,000 log entries in just 3.3 milliseconds. But speed wasn't the only goal - I wanted to make log analysis actually enjoyable.

The Problem

We've all been there: production issues at 3 AM, scrolling through endless logs, trying to spot patterns with tired eyes. Existing tools either:

  • Dump everything to stdout (grep, awk)
  • Require complex query languages (LogQL, KQL)
  • Need heavy infrastructure (ELK stack)
  • Cost a fortune (Datadog, Splunk)

I wanted something that just works, runs locally, and makes patterns obvious.

The Solution: LogSum

LogSum combines three things that rarely go together:

  1. Blazing fast performance - 3.3ms for 10K entries
  2. Beautiful terminal UI - with animations and colors
  3. Intelligent analysis - automatic pattern detection

Key Features

πŸ” Smart Pattern Detection

$ logsum analyze app.log
βœ“ Analyzed 10,000 entries in 3.3ms
βœ“ Found 7 patterns
βœ“ Generated 3 insights
Enter fullscreen mode Exit fullscreen mode

LogSum tries to identify:

  • Error patterns and anomalies
  • Performance degradations
  • Status code distributions
  • Timeline-based spikes

🎨 Interactive Terminal UI
The TUI features:

  • Rainbow animated borders (because why not?)
  • Keyboard navigation between patterns/insights/logs
  • Real-time pattern highlighting
  • ASCII charts for visualizations

πŸ“Š Multiple Output Formats

# Beautiful terminal output (default)
logsum analyze app.log

# Machine-readable JSON
logsum analyze app.log -f json

# Markdown report
logsum analyze app.log -f markdown -o report.md

# CSV for further analysis
logsum analyze app.log -f csv -o patterns.csv
Enter fullscreen mode Exit fullscreen mode

Technical Implementation

Performance Secrets

The 3.3ms performance comes from:

  1. Zero-copy parsing where possible
  2. Efficient pattern matching
  3. Efficient data structures - avoiding allocations in hot paths

Architecture

LogSum follows clean architecture principles:

internal/
β”œβ”€β”€ parser/      # Multi-format log parsing
β”œβ”€β”€ analyzer/    # Pattern detection engine
β”œβ”€β”€ formatter/   # Output formatting
└── ui/          # Bubble Tea TUI
Enter fullscreen mode Exit fullscreen mode

Each component is independent and testable. The parser handles JSON, logfmt, and plain text logs automatically.

The TUI Magic

Built with Bubble Tea, the UI updates at 30 FPS for smooth animations:

type model struct {
    activeView  View
    patterns    []Pattern
    insights    []Insight
    borderColor int // for rainbow animation
}
Enter fullscreen mode Exit fullscreen mode

Try It Yourself

# Install
go install github.com/yildizm/LogSum/cmd/logsum@latest

# Analyze your logs
logsum analyze /var/log/app.log

# Watch mode for real-time analysis
logsum watch /var/log/app.log

# Get sample logs to try
curl -L https://github.com/yildizm/LogSum/raw/main/testdata/sample.log > sample.log
logsum analyze sample.log -v
Enter fullscreen mode Exit fullscreen mode

What's Next?

This is just v0.1.0! New features are coming soon.

PS

The project is open source and MIT licensed. I'd love your feedback, bug reports, and contributions!

Links:


What log analysis features would you like to see? Let me know in the comments!

Top comments (0)