Compress logs for LLM analysis (Rust-powered)
Project description
logzip (Rust)
Compress logs before sending to LLM. Powered by Rust & PyO3.
raw log → [logzip compress] → compressed text → LLM (Claude Code / Cursor / API)
Typical savings: 40–60% on structured logs (systemd, uvicorn, docker).
Anomalies and unique lines stay uncompressed — visible at a glance in the BODY.
Performance (8MB Log)
| Quality | Time (s) | Savings (%) | Entries | Description |
|---|---|---|---|---|
| fast | ~0.5s | 35-40% | 32 | Default, near instant |
| balanced | ~0.4s | 50-55% | 128 | Best for daily use |
| max | ~0.5s | 55-60% | 512 | Max compression |
Benchmarked on a real 8MB RAG system log. Sub-second performance for multi-megabyte files.
Install
# Requires Rust toolchain for building from source
pip install .
CLI
# stdin → stdout (основной режим)
cat app.log | logzip compress | pbcopy # → буфер → вставить в Claude
# с выбором качества (fast|balanced|max)
logzip compress --quality balanced < app.log
# с preamble (инструкции для LLM в начале вывода)
logzip compress --preamble < app.log > compressed.txt
# сохранить + показать статистику
logzip compress --stats -i app.log -o app.logzip
# явно указать профиль (иначе auto-detect)
logzip compress --profile journalctl < /tmp/syslog.txt
Python API
from logzip import compress, decompress
# сжатие
result = compress(raw_log_text, quality="balanced")
print(result.render(with_preamble=True)) # → в LLM
print(result.stats_str()) # → в stderr
Архитектура (Rust)
- Normalizer: Схлопывание ANSI, таймстампов, IP и общего префикса.
- Frequency Analysis: Параллельный подсчет n-грамм (rayon).
- Greedy Legend: Оптимизированный выбор легенды через позиционный индекс (O(N)).
- Direct Replacement: Прямая замена без повторного сканирования.
- Templates: Извлечение повторяющихся структур строк.
Тесты
python -m pytest tests/ -v
Roadmap / v2
- MCP-сервер для Claude Code
- suffix automaton для поиска произвольных повторов
- streaming mode для гигантских файлов
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
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file logzip-0.1.0.tar.gz.
File metadata
- Download URL: logzip-0.1.0.tar.gz
- Upload date:
- Size: 863.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
010aafd48d8152cd8d353c3df9bf65043c24617517966fd1ac7b6a25a0fcf631
|
|
| MD5 |
caf7467a2d29eb2783a9f5da5ad580e4
|
|
| BLAKE2b-256 |
b7d38be412559d1d70969d130e6899633e9ab437459d34d33ae599e4e02edf10
|
Provenance
The following attestation bundles were made for logzip-0.1.0.tar.gz:
Publisher:
publish.yml on NailShakurov/logzip
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
logzip-0.1.0.tar.gz -
Subject digest:
010aafd48d8152cd8d353c3df9bf65043c24617517966fd1ac7b6a25a0fcf631 - Sigstore transparency entry: 1356279959
- Sigstore integration time:
-
Permalink:
NailShakurov/logzip@4a93eba6e25420166841cc7d9d548cc16dbbb769 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/NailShakurov
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@4a93eba6e25420166841cc7d9d548cc16dbbb769 -
Trigger Event:
push
-
Statement type:
File details
Details for the file logzip-0.1.0-cp39-abi3-win_amd64.whl.
File metadata
- Download URL: logzip-0.1.0-cp39-abi3-win_amd64.whl
- Upload date:
- Size: 833.8 kB
- Tags: CPython 3.9+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d92e7b494a3913d9636c2382d91aec563a7327a88aeb1a8cf201a4bd8551f26e
|
|
| MD5 |
67558ffe0ae59408bb4aaebf5177ae84
|
|
| BLAKE2b-256 |
710968f10832c169c67d65ef0490abd9f5b4acbc22114a93924e977913253c35
|
Provenance
The following attestation bundles were made for logzip-0.1.0-cp39-abi3-win_amd64.whl:
Publisher:
publish.yml on NailShakurov/logzip
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
logzip-0.1.0-cp39-abi3-win_amd64.whl -
Subject digest:
d92e7b494a3913d9636c2382d91aec563a7327a88aeb1a8cf201a4bd8551f26e - Sigstore transparency entry: 1356280058
- Sigstore integration time:
-
Permalink:
NailShakurov/logzip@4a93eba6e25420166841cc7d9d548cc16dbbb769 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/NailShakurov
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@4a93eba6e25420166841cc7d9d548cc16dbbb769 -
Trigger Event:
push
-
Statement type:
File details
Details for the file logzip-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: logzip-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 912.4 kB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d99bccf5a032365286a7458db661216e963575a5d639f0160fdcd7ada1085463
|
|
| MD5 |
a0928ca1e763acfae16010570e9fbe29
|
|
| BLAKE2b-256 |
71377bef8d7e51a7de7aed3466388477dacab120829a691c7efdfdab56376fe9
|
Provenance
The following attestation bundles were made for logzip-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
publish.yml on NailShakurov/logzip
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
logzip-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
d99bccf5a032365286a7458db661216e963575a5d639f0160fdcd7ada1085463 - Sigstore transparency entry: 1356280023
- Sigstore integration time:
-
Permalink:
NailShakurov/logzip@4a93eba6e25420166841cc7d9d548cc16dbbb769 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/NailShakurov
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@4a93eba6e25420166841cc7d9d548cc16dbbb769 -
Trigger Event:
push
-
Statement type:
File details
Details for the file logzip-0.1.0-cp39-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.
File metadata
- Download URL: logzip-0.1.0-cp39-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
- Upload date:
- Size: 1.6 MB
- Tags: CPython 3.9+, macOS 10.12+ universal2 (ARM64, x86-64), macOS 10.12+ x86-64, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1d719542f00b47da964ef089ecb19034df2c0f4a135e84a36e8d02322922bdfa
|
|
| MD5 |
4be7cb8fabbe5f0b5eec0fb1b5f4454f
|
|
| BLAKE2b-256 |
015170bd5d9f631549ae4e7c621239e40ec2e163a9c4aebaf454f816ff976d05
|
Provenance
The following attestation bundles were made for logzip-0.1.0-cp39-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl:
Publisher:
publish.yml on NailShakurov/logzip
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
logzip-0.1.0-cp39-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl -
Subject digest:
1d719542f00b47da964ef089ecb19034df2c0f4a135e84a36e8d02322922bdfa - Sigstore transparency entry: 1356279992
- Sigstore integration time:
-
Permalink:
NailShakurov/logzip@4a93eba6e25420166841cc7d9d548cc16dbbb769 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/NailShakurov
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@4a93eba6e25420166841cc7d9d548cc16dbbb769 -
Trigger Event:
push
-
Statement type: