Skip to main content

Beautiful local log viewer with thread tracking and real-time updates

Project description

Logler ๐Ÿ”

Beautiful local log viewer with thread tracking and real-time updates

PyPI version Python 3.9+

A modern, feature-rich log viewer that makes debugging a pleasure. View logs in your terminal with beautiful colors or start a web interface with WebSocket support for real-time updates.

โœจ Features

  • ๐ŸŽจ Beautiful Terminal Output - Rich colors and formatting with thread visualization
  • ๐ŸŒ Gorgeous Web UI - Modern interface with file picker and live updates
  • ๐Ÿงต Thread Tracking - Follow execution flow across log entries
  • ๐Ÿ”— Correlation IDs - Track requests across microservices
  • ๐Ÿ“Š Distributed Tracing - OpenTelemetry span/trace support
  • โšก Real-time Streaming - WebSocket support for live log following
  • ๐Ÿ” Smart Filtering - By level, thread, pattern, or correlation ID
  • ๐Ÿ“ Multi-Format Support - JSON, plain text, syslog, and more
  • ๐Ÿ“‚ File Picker - Browse and select log files from the UI
  • ๐ŸŽฏ Zero Config - Works out of the box

๐Ÿค– NEW: LLM Investigation Engine

Rust-powered log investigation designed for AI agents - the most LLM-friendly log tool available!

Core Features

  • โšก Blazing Fast - Search 1GB files in <50ms with parallel processing
  • ๐Ÿ” Semantic Search - Find errors by description, not just exact matches
  • ๐Ÿงต Thread Following - Reconstruct request flows across distributed systems
  • ๐ŸŒณ Hierarchy Visualization - Tree and waterfall views of nested operations, bottleneck detection
  • ๐Ÿ“Š Pattern Detection - Automatically find repeated errors and cascading failures
  • ๐Ÿ’พ SQL Queries - DuckDB-powered custom analysis for deep investigation
  • ๐Ÿ“ˆ Statistical Analysis - Z-scores, percentiles, correlations, anomaly detection
  • ๐ŸŒ Bilingual Docs - Complete documentation in English and Japanese (ๆ—ฅๆœฌ่ชž)

๐Ÿš€ NEW: Advanced LLM Features

Designed specifically for AI agents with limited context windows:

  • ๐Ÿ’ก Auto Insights - analyze_with_insights() automatically detects patterns, errors, and suggests next steps
  • ๐Ÿ“‰ Token-Efficient Output - 44x token savings with summary/count/compact modes
  • ๐Ÿ”€ Compare & Diff - Compare successful vs failed requests, before/after deployments
  • ๐ŸŒ Cross-Service Timeline - Unified view across microservices for distributed debugging
  • ๐Ÿ“ Investigation Sessions - Track progress, undo/redo, save/resume investigations
  • ๐ŸŽฏ Smart Sampling - Representative sampling with multiple strategies (diverse, errors-focused, chronological)
  • ๐Ÿ“„ Report Generation - Auto-generate markdown/text/JSON reports from investigation
  • ๐Ÿค” Explain Feature - Plain English explanations of cryptic errors with next steps
  • ๐Ÿ’ฌ Contextual Suggestions - AI suggests what to investigate next based on findings
import logler.investigate as investigate

# ๐ŸŽฏ One-line auto investigation with insights
result = investigate.analyze_with_insights(files=["app.log"])
print(result['insights'])  # Automatic pattern detection, error analysis, suggestions

# ๐Ÿ“‰ Token-efficient search (44x smaller output)
errors = investigate.search(files=["app.log"], level="ERROR", output_format="summary")
# Returns aggregated stats instead of all entries - perfect for limited context windows

# ๐Ÿ”€ Compare successful vs failed requests
diff = investigate.compare_threads(
    files=["app.log"],
    correlation_a="req-success-123",
    correlation_b="req-failed-456"
)
print(diff['summary'])  # "Thread B took 2341ms longer and had 5 errors (cache miss, timeout)"

# ๐ŸŒ Cross-service distributed tracing
timeline = investigate.cross_service_timeline(
    files={"api": ["api.log"], "db": ["db.log"], "cache": ["cache.log"]},
    correlation_id="req-12345"
)
# See request flow: API โ†’ DB โ†’ Cache with latency breakdown

# ๐Ÿ“ Track investigation with sessions
session = investigate.InvestigationSession(files=["app.log"], name="incident_2024")
session.search(level="ERROR")
session.find_patterns()
session.add_note("Database connection pool exhausted")
report = session.generate_report(format="markdown")  # Auto-generate report

# ๐ŸŽฏ Smart sampling (representative sample of huge logs)
sample = investigate.smart_sample(
    files=["huge.log"],
    strategy="errors_focused",  # or "diverse", "representative", "chronological"
    sample_size=50
)

# ๐Ÿค” Explain cryptic errors in plain English
explanation = investigate.explain(error_message="Connection pool exhausted", context="production")
print(explanation)  # Common causes, next steps, production-specific advice

# ๐ŸŒณ Hierarchical thread visualization (NEW!)
hierarchy = investigate.follow_thread_hierarchy(
    files=["app.log"],
    root_identifier="req-123",
    min_confidence=0.8  # Only show high-confidence relationships
)

# Automatic bottleneck detection
if hierarchy['bottleneck']:
    print(f"Bottleneck: {hierarchy['bottleneck']['node_id']} took {hierarchy['bottleneck']['duration_ms']}ms")

# Get summary
summary = investigate.get_hierarchy_summary(hierarchy)
print(summary)  # Shows tree structure, errors, bottlenecks

# Visualize in CLI
from tree_formatter import print_tree, print_waterfall
print_tree(hierarchy, mode="detailed", show_duration=True)
print_waterfall(hierarchy, width=100)  # Waterfall timeline showing parallel operations

๐Ÿ“š Complete LLM documentation:

๐Ÿš€ Quick Start

Installation

# Using pip
pip install logler

# Using uv (recommended)
uv pip install logler

Usage

Start the web interface:

logler serve                    # Start with file picker
logler serve app.log            # Open specific file
logler serve *.log              # Open multiple files
logler serve --open             # Auto-open browser

Security and path restrictions

  • The legacy Python web UI now enforces a log root to avoid accidental exposure of arbitrary files. Set LOGLER_ROOT to the directory you want to browse (defaults to the current working directory). Requests outside that root are rejected.
  • For production or remote access, place the service behind authentication/reverse proxies; the built-in UI is intended for local or trusted environments only.

View logs in terminal:

logler view app.log                      # View entire file
logler view app.log -n 100               # Last 100 lines
logler view app.log -f                   # Follow in real-time
logler view app.log --level ERROR        # Filter by level
logler view app.log --grep "timeout"     # Search pattern
logler view app.log --thread worker-1    # Filter by thread

Show statistics:

logler stats app.log             # Show statistics
logler stats app.log --json      # JSON output

Investigate logs with smart analysis:

logler investigate app.log --auto-insights        # Auto-detect issues
logler investigate app.log --errors               # Analyze errors
logler investigate app.log --patterns             # Find repeated patterns
logler investigate app.log --thread worker-1      # Follow specific thread
logler investigate app.log --correlation req-123  # Follow correlation ID
logler investigate app.log --output summary       # Token-efficient output

# ๐ŸŒณ NEW: Hierarchical Thread Visualization
logler investigate app.log --correlation req-123 --hierarchy         # Show thread hierarchy tree
logler investigate app.log --trace trace-abc123 --hierarchy --waterfall  # Show waterfall timeline
logler investigate app.log --correlation req-123 --hierarchy --flamegraph # Show flamegraph view
logler investigate app.log --hierarchy --show-error-flow             # Analyze error propagation
logler investigate app.log --thread worker-1 --hierarchy --max-depth 3   # Limit hierarchy depth

Visualization Modes

Tree View - Shows parent-child relationships:

๐Ÿงต api-gateway (req-001, 520ms)
โ”œโ”€ ๐Ÿ”น auth-service (45ms)
โ”‚  โ”œโ”€ ๐Ÿ”ธ jwt-validate (5ms)
โ”‚  โ””โ”€ ๐Ÿ”ธ user-lookup (25ms)
โ”œโ”€ ๐Ÿ”น product-service (450ms) โš ๏ธ SLOW
โ”‚  โ”œโ”€ ๐Ÿ”ธ inventory-check (340ms)
โ”‚  โ”‚  โ””โ”€ ๐Ÿ”ธ db-query (300ms) โš ๏ธ
โ”‚  โ””โ”€ ๐Ÿ”ธ cache-update (45ms) โŒ ERROR
โ””โ”€ ๐Ÿ”น response-assembly (10ms)

Waterfall View (--waterfall) - Shows temporal overlap:

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Timeline: req-001 (520ms)                                            โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ api-gateway          โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ  520ms โ”‚
โ”‚   โ”œโ”€ auth-service    โ–ˆโ–ˆโ–ˆโ–ˆ                                      45ms โ”‚
โ”‚   โ”œโ”€ product-service      โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ    450ms โ”‚
โ”‚   โ”‚  โ”œโ”€ inventory              โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ         340ms โ”‚
โ”‚   โ”‚  โ””โ”€ cache-update                              โ–ˆโ–ˆโ–ˆโ–ˆโŒ        45ms โ”‚
โ”‚   โ””โ”€ response                                          โ–ˆโ–ˆ      10ms โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Flamegraph View (--flamegraph) - Shows time distribution:

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ api-gateway (520ms)                                                โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ auth (45) โ”‚ product-service (450ms)                         โš      โ”‚
โ”‚           โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚           โ”‚ inventory-check (340ms)     โ”‚ cache-update (45ms) โŒ   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Error Flow (--show-error-flow) - Traces error propagation:

๐Ÿ” Error Flow Analysis

Root Cause:
  โŒ cache-update failed at 10:00:00.450Z
  Error: Redis connection refused
  Path: api-gateway โ†’ product-service โ†’ cache-update

Impact: 3 nodes affected, request degraded
Recommendation: Check Redis connectivity

Watch for new files:

logler watch "*.log"             # Watch for new log files
logler watch "app-*.log" -d /var/log    # Specific directory

๐Ÿ“ธ Screenshots

Web Interface

Beautiful, modern web UI with file picker and real-time updates:

  • ๐Ÿ“ Browse and select log files
  • ๐ŸŽจ Syntax-highlighted logs
  • ๐Ÿงต Thread visualization
  • ๐Ÿ“Š Live statistics
  • ๐Ÿ”„ Real-time following with WebSocket

Terminal

Rich, colorful terminal output:

  • ๐ŸŒˆ Color-coded log levels
  • ๐Ÿงต Thread badges
  • ๐Ÿ”— Correlation ID tracking
  • ๐Ÿ“ˆ Thread timelines

๐ŸŽฏ Examples

Web Interface

# Start server and auto-open browser
logler serve --open

# Start with specific files
logler serve /var/log/app.log /var/log/error.log

# Custom host/port
logler serve --host 0.0.0.0 --port 9000

Then open your browser to http://localhost:8000 and:

  1. Click "๐Ÿ“ Open File" to browse log files
  2. Filter by level, search, or thread
  3. Click "๐Ÿ”„ Follow" for real-time streaming
  4. View thread timelines and statistics

Terminal Viewing

# Basic viewing
logler view app.log

# Follow with filters
logler view app.log -f --level ERROR --grep "database"

# Multiple files
logler view app.log error.log -n 50

# Beautiful thread view
logler view app.log --thread worker-1

Statistics

# Human-readable stats
logler stats app.log

# JSON for scripting
logler stats app.log --json | jq '.by_level'

Investigation & Analysis

# Auto-detect issues with insights
logler investigate app.log --auto-insights
# Output: Automatic error analysis, pattern detection, actionable suggestions

# Analyze errors with context
logler investigate app.log --errors
# Shows error frequency, top error messages, time ranges

# Find repeated patterns
logler investigate app.log --patterns --min-occurrences 5
# Identifies logs that repeat 5+ times

# Follow a specific thread or request
logler investigate app.log --thread worker-1
logler investigate app.log --correlation req-abc123

# Token-efficient output for LLMs
logler investigate app.log --auto-insights --output summary
# Returns aggregated statistics instead of full logs

# JSON output for automation
logler investigate app.log --errors --json

๐ŸŽจ Log Format Support

Logler automatically detects and parses:

JSON Logs:

{
  "timestamp": "2024-01-15T10:00:00Z",
  "level": "INFO",
  "message": "User logged in",
  "thread_id": "worker-1",
  "correlation_id": "req-123",
  "trace_id": "abc123",
  "span_id": "span-001"
}

Plain Text:

2024-01-15 10:00:00 INFO [worker-1] [req-123] User logged in
2024-01-15 10:00:01 ERROR [worker-2] Database timeout trace_id=abc123

With Thread Tracking:

2024-01-15 10:00:00 INFO [worker-1] Request started
2024-01-15 10:00:01 DEBUG [worker-1] Processing...
2024-01-15 10:00:02 INFO [worker-1] Request completed

Logler groups these together and shows the complete thread timeline!

๐ŸŽฏ Perfect Log Format for Maximum Features

To unlock all of logler's capabilities (especially multi-level thread hierarchy), use this format:

JSON (Recommended):

{
  "timestamp": "2024-01-15T10:00:00.123Z",
  "level": "INFO",
  "message": "Processing user request",
  "thread_id": "worker-1",
  "correlation_id": "req-abc123",
  "trace_id": "trace-xyz789",
  "span_id": "span-001",
  "parent_span_id": "span-000"
}

Field Guide:

Field Purpose Enables
timestamp When the event occurred (ISO 8601) Timeline, duration analysis
level Log level (DEBUG/INFO/WARN/ERROR/FATAL) Filtering, error detection
message Human-readable description Search, pattern detection
thread_id Thread/worker identifier Thread grouping, timeline
correlation_id Request ID across services Cross-service tracing
trace_id Distributed trace identifier OpenTelemetry integration
span_id Unique operation identifier Hierarchy building
parent_span_id Parent operation's span_id Multi-level hierarchy trees

Why parent_span_id matters:

Without it, logler infers hierarchy from naming patterns (worker-1.task-a) or temporal proximity. With explicit parent_span_id, you get:

  • 100% accurate parent-child relationships
  • Deep hierarchy trees (not just 1-2 levels)
  • Precise bottleneck detection
  • Accurate error propagation tracing

Plain Text Alternative:

2024-01-15T10:00:00.123Z INFO [worker-1] [req-abc123] [trace:xyz789] [span:001] [parent:000] Processing user request

Logler will parse bracketed fields automatically. Use consistent formatting across your application.

๐Ÿงต Thread Tracking

Logler automatically tracks threads and shows:

  • ๐Ÿ“Š Log count per thread
  • โŒ Error count per thread
  • โฑ๏ธ Thread duration
  • ๐Ÿ”— Associated correlation IDs
  • ๐Ÿ“ˆ Thread timeline

Example:

logler view app.log

Shows threads in sidebar with:

  • Thread ID badge
  • Number of logs
  • Error count (if any)

Click any thread to filter logs!

๐Ÿ”— Correlation & Tracing

Track requests across services:

# Logs with correlation IDs are automatically linked
logler view app.log

In the web UI:

  • See correlation IDs in log entries
  • Filter by correlation ID
  • View complete request flow
  • Track distributed traces

โš™๏ธ Configuration

Logler works with zero configuration, but you can customize:

# Server options
logler serve --host 0.0.0.0 --port 8000

# View options
logler view app.log --no-color    # Disable colors
logler view app.log -n 1000        # Show more lines

๐Ÿ› ๏ธ Development

# Clone repository
git clone https://github.com/gabu-quest/logler.git
cd logler

# Install in development mode
pip install -e ".[dev]"

# Run tests
pytest

# Format code
black logler
ruff check logler

๐Ÿ“ฆ What's Included

  • logler - Main CLI command
  • Rich Terminal UI - Beautiful colored output
  • FastAPI Web Server - Modern web interface
  • WebSocket Support - Real-time log streaming
  • Thread Tracker - Correlation and grouping
  • Smart Parser - Multi-format support
  • File Watcher - Monitor for new files

๐Ÿค Contributing

Contributions welcome! Please feel free to submit a Pull Request.

๐Ÿ“„ License

MIT License - see LICENSE file for details.

๐Ÿ™ Acknowledgments

Built with:

๐Ÿ’ก Pro Tips

  1. Use --follow mode for real-time debugging
  2. Filter by thread to trace execution flow
  3. Use the web UI for complex log analysis
  4. Export stats as JSON for automation
  5. Watch directories for new log files

๐ŸŽ“ Examples

Debug a specific request

# Find correlation ID
logler view app.log --grep "req-12345"

# Follow that request across services
logler view app.log service.log --grep "req-12345"

Monitor errors in real-time

logler view app.log -f --level ERROR

Analyze thread behavior

logler view app.log --thread worker-1

Beautiful web dashboard

logler serve app.log --open
# Then explore threads, traces, and statistics!

Made with โค๏ธ for developers who love beautiful tools

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

logler-1.0.1-cp311-cp311-manylinux_2_38_x86_64.whl (17.3 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.38+ x86-64

File details

Details for the file logler-1.0.1-cp311-cp311-manylinux_2_38_x86_64.whl.

File metadata

File hashes

Hashes for logler-1.0.1-cp311-cp311-manylinux_2_38_x86_64.whl
Algorithm Hash digest
SHA256 33741c97a15b9c232d08dd5520b7b9b1e26fd0f14ef990d4e2a919f675836f0c
MD5 61d43c6bac2e1887f5a6c34a5a6675cc
BLAKE2b-256 88dcc75df6a24acbc31e42b1a59f93ab9ea8b6ab233ca67754d82ad3fb64f6a2

See more details on using hashes here.

Provenance

The following attestation bundles were made for logler-1.0.1-cp311-cp311-manylinux_2_38_x86_64.whl:

Publisher: pypi.yml on gabu-quest/logler

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page