Metadata-Version: 2.4
Name: mzgb
Version: 0.1.1
Summary: Fast CLI for filtering very large log files by level, pattern, and time range
License: MIT License
        
        Copyright (c) 2024 Mukhtar Saeed
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/mukesudo/mzgb
Project-URL: Repository, https://github.com/mukesudo/mzgb
Project-URL: Issues, https://github.com/mukesudo/mzgb/issues
Keywords: log,filter,cli,grep,logging,devops,tail
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: System :: Logging
Classifier: Topic :: Utilities
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: click>=8.1.0
Requires-Dist: rich>=13.0.0
Requires-Dist: python-dateutil>=2.8.0
Provides-Extra: dev
Requires-Dist: pytest>=7.4; extra == "dev"
Requires-Dist: pytest-cov>=4.1; extra == "dev"
Dynamic: license-file

# mzgb

[![Tests](https://img.shields.io/badge/tests-99%20passing-39d353?style=flat-square)](https://github.com/mukesudo/mzgb)
[![Coverage](https://img.shields.io/badge/coverage-91%25-39d353?style=flat-square)](https://github.com/mukesudo/mzgb)
[![PyPI](https://img.shields.io/badge/pypi-v0.1.0-4af0d0?style=flat-square)](https://pypi.org/project/mzgb)
[![Python](https://img.shields.io/badge/python-3.9+-4af0d0?style=flat-square)](https://pypi.org/project/mzgb)
[![License](https://img.shields.io/badge/license-MIT-white?style=flat-square)](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

```bash
pip install mzgb
```

Or from source:

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

## Usage

```bash
# 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

```bash
# Run tests
python -m pytest

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

## License

MIT — see [LICENSE](LICENSE)
