Skip to main content

A lightweight structured log viewer with live streaming and filters.

Project description

Log4Lab

A lightweight structured log viewer with live streaming, filtering, and rich content rendering.

Log4Lab is a web-based dashboard for viewing and analyzing structured JSON logs in real-time. It provides a clean interface for monitoring application logs with live updates, making it easy to track experiments and debug issues.

Installation

Using pipx (Recommended)

Install log4lab as an isolated application:

pipx install log4lab

Using pip

pip install log4lab

From source

git clone https://github.com/tlamadon/log4lab.git
cd log4lab
pip install -e .

Quick Start

  1. Start the web interface:

    log4lab serve logs/app.log
    

    Then open http://localhost:8000

  2. View logs in terminal:

    log4lab tail logs/app.log
    
  3. Export to HTML:

    log4lab export logs/app.log -o report.html
    

Log Format

Log4Lab expects JSONL format (one JSON object per line):

{"time": "2025-02-03T10:30:00Z", "level": "INFO", "section": "train", "message": "Training started"}
{"time": "2025-02-03T10:30:05Z", "level": "WARN", "section": "data", "message": "Missing data point"}
{"time": "2025-02-03T10:30:10Z", "level": "ERROR", "section": "model", "message": "Model failed to converge"}

With Rich Content

Log4Lab can display various file types when you include a cache_path field:

{
  "time": "2025-02-03T10:30:00Z",
  "level": "INFO",
  "section": "train",
  "message": "Training complete",
  "cache_path": "artifacts/results.png",
  "run_name": "experiment_1",
  "accuracy": 0.95
}

Supported content types:

  • Images: PNG, JPG, SVG, etc. (displayed inline)
  • Code files: Python, JavaScript, JSON, YAML, etc. (syntax highlighted, collapsible)
  • Markdown: .md files (rendered as HTML, collapsible)
  • PDFs: Embedded viewer
  • Other files: Download links

Core Fields

  • time: Timestamp in ISO 8601 format
  • level: Log level (INFO, WARN, ERROR, DEBUG)
  • section: Component or module name
  • message or msg: Main log message
  • cache_path: Path to artifact file
  • run_name: Name of the run collection
  • run_id: Unique run identifier

Any additional fields are shown in the expandable JSON view.

Commands

Serve (Web Interface)

log4lab serve [LOGFILE]

# Options:
--host 0.0.0.0        # Bind to all interfaces (default: 127.0.0.1)
--port 3000           # Custom port (default: 8000)
--reload              # Auto-reload for development

Tail (Terminal)

log4lab tail [LOGFILE]

# Options:
--level ERROR         # Filter by log level
--open-images         # Open images automatically

Export

log4lab export [LOGFILE] -o output.html

# Options:
-o, --output FILE     # Output file path
-t, --title TEXT      # Custom page title
--no-embed-images     # Don't embed images (smaller file)

Filtering

The web interface supports:

  • Level filtering: Dropdown with all levels found in logs
  • Text filters: Section, run name, run ID (partial matching)
  • Time range: Last 1m, 5m, 30m, 1h, 6h, 24h
  • URL filters: Bookmark and share filtered views
# Filter by error logs from last hour
http://localhost:8000/?level=error&time=3600

# View specific run
http://localhost:8000/?run_name=experiment_1

Use Cases

Machine Learning: Track training runs with metrics and plots

{"run_name": "resnet_training", "epoch": 10, "loss": 0.23, "cache_path": "plots/loss.png"}

Debugging: Monitor distributed systems across components

{"section": "api", "level": "ERROR", "message": "Connection timeout", "duration_ms": 5000}

Research: Document experiments with artifacts

{"run_name": "param_sweep", "message": "Testing lr=0.001", "cache_path": "results.pdf"}

License

MIT

Project details


Download files

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

Source Distribution

log4lab-0.0.3.tar.gz (32.3 kB view details)

Uploaded Source

Built Distribution

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

log4lab-0.0.3-py3-none-any.whl (32.9 kB view details)

Uploaded Python 3

File details

Details for the file log4lab-0.0.3.tar.gz.

File metadata

  • Download URL: log4lab-0.0.3.tar.gz
  • Upload date:
  • Size: 32.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for log4lab-0.0.3.tar.gz
Algorithm Hash digest
SHA256 b15f37d114f159e18031f0231b2b16b3819cc633b6e1f573baec31496b3b964e
MD5 a77b42fc58ce02eb1609bc1eb1fe77b9
BLAKE2b-256 4be706122f9e412d7c42cb7ae7e6825e308b32079db131a7354f62f397d1220a

See more details on using hashes here.

Provenance

The following attestation bundles were made for log4lab-0.0.3.tar.gz:

Publisher: publish.yml on tlamadon/log4lab

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

File details

Details for the file log4lab-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: log4lab-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 32.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for log4lab-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 31c13c62c27fb47c0930ddd0ddb9e1007fc09ef24982b22e9902b1e2455a564d
MD5 63f8b8ef8ebe5f74f407f250040e5a1e
BLAKE2b-256 53acb1d8b9e73d0e54aa60a2835275b6c6adeebc3cb5c46373db855405d6637d

See more details on using hashes here.

Provenance

The following attestation bundles were made for log4lab-0.0.3-py3-none-any.whl:

Publisher: publish.yml on tlamadon/log4lab

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