Metadata-Version: 2.4
Name: log-compactor
Version: 0.1.0
Summary: A real-time, configurable log deduplication and compaction tool.
Author: Nikhil Budaniya
License-Expression: GPL-3.0-only
Project-URL: Homepage, https://pypi.org/project/log-compactor/
Project-URL: Documentation, https://github.com/NikhilBudaniya/log-compactor#readme
Project-URL: Repository, https://github.com/NikhilBudaniya/log-compactor
Project-URL: Issues, https://github.com/NikhilBudaniya/log-compactor/issues
Project-URL: Changelog, https://github.com/NikhilBudaniya/log-compactor/blob/main/CHANGELOG.md
Keywords: logging,logs,cli,deduplication,compaction,syslog,terminal
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
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: Programming Language :: Python :: 3.13
Classifier: Topic :: System :: Logging
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pydantic>=2.0
Requires-Dist: click>=8.0
Requires-Dist: rich>=13.0
Requires-Dist: pyyaml>=6.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Dynamic: license-file

# Log Compactor

A real-time, configurable log deduplication and compaction utility. It supports dynamic regex parsing, key-value extraction, raw pass-through for unstructured lines, time-window deduplication, and error escalation.

## Installation

From the project root (development):

```bash
pip install -e ".[dev]"
```

Or install the package only:

```bash
pip install -e .
```

The `dev` extra includes pytest.

## Pipe any command’s output

Install the package, add a `config.yaml` (or pass `--config`), and pipe stdout through the CLI:

```bash
pytest -q 2>&1 | logcompact stream -c /path/to/config.yaml
```

```bash
python app.py 2>&1 | logcompact stream
```

If you omit `-c`, the CLI looks for `config.yaml` in the current working directory.

## Library usage

```python
from compactor import SmartCompactor

settings = {"dedup_window_seconds": 5, "error_threshold": 2}
compactor = SmartCompactor(settings)
for line in compactor.compact_stream(open("app.log")):
    print(line)
```

## Tests

```bash
pytest
```

## Changelog

See [`CHANGELOG.md`](CHANGELOG.md) for version history and release notes.

## License

This project is licensed under the [GNU General Public License v3.0 only](https://www.gnu.org/licenses/gpl-3.0.html). See the [`LICENSE`](LICENSE) file for the full license text.
