Skip to main content

Fast CLI for filtering very large log files by level, pattern, and time range

Project description

mzgb

Tests Coverage PyPI Python License

mzgb (mezgeb — "record" in Amharic) is a fast CLI tool for filtering and navigating very large log files. Streams line by line — no memory issues, no matter the file size.

Filter by log level, regex pattern, or time range. Works with plaintext, JSON, and logfmt logs. Pipes cleanly with kubectl, journalctl, cat, and friends.

Install

pip install mzgb

Or from source:

git clone https://github.com/mukesudo/mzgb.git
cd mzgb
python3 -m mzgb --help

Usage

# Filter by log level
mzgb --level ERROR app.log

# Pattern search with context lines
mzgb --pattern "timeout" -C 2 app.log

# Filter by time range
mzgb --from "2024-01-15 14:00" --to "2024-01-15 15:00" app.log

# Pipe from anywhere
kubectl logs pod/api | mzgb --level ERROR
journalctl | mzgb --summary

# Follow live logs
mzgb --follow --level ERROR app.log

Options

Flag Description
--level Filter by log level (ERROR, WARN, INFO). Repeatable.
--pattern Filter by keyword or regex.
--from / --to Time range filter.
-C / --context Show N lines before and after each match.
--summary Print a summary table instead of raw lines.
--follow Follow file for new lines (like tail -f).

Development

# Run tests
python -m pytest

# Run with coverage
python -m pytest --cov=mzgb

License

MIT — see LICENSE

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

mzgb-0.1.1.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

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

mzgb-0.1.1-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

Details for the file mzgb-0.1.1.tar.gz.

File metadata

  • Download URL: mzgb-0.1.1.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for mzgb-0.1.1.tar.gz
Algorithm Hash digest
SHA256 96dd66859ccbaa7e34cd91a3f06fb4c245fd023fae503f5aeea69da5361f73c3
MD5 c08732d0d5786375f3d92d928029927f
BLAKE2b-256 6d03951f99a78e6ef44926db77453deed5ec9e9e5efbb3fb6ab3635b9c611e16

See more details on using hashes here.

File details

Details for the file mzgb-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: mzgb-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 14.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for mzgb-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 48e40cf0ef2636e12bda0f09023656fdf2f23a56a02f4eec97787ab65f75fe6e
MD5 35c11bbe0765b9a8f6f8c21b74bb05dd
BLAKE2b-256 af42b202e448136dfba912727c8b1fa0ba59e5e5b29052531d675fb15339ada6

See more details on using hashes here.

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