Skip to main content

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)

  1. Normalizer: Схлопывание ANSI, таймстампов, IP и общего префикса.
  2. Frequency Analysis: Параллельный подсчет n-грамм (rayon).
  3. Greedy Legend: Оптимизированный выбор легенды через позиционный индекс (O(N)).
  4. Direct Replacement: Прямая замена без повторного сканирования.
  5. 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

logzip-0.1.0.tar.gz (863.3 kB view details)

Uploaded Source

Built Distributions

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

logzip-0.1.0-cp39-abi3-win_amd64.whl (833.8 kB view details)

Uploaded CPython 3.9+Windows x86-64

logzip-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (912.4 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ x86-64

logzip-0.1.0-cp39-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (1.6 MB view details)

Uploaded CPython 3.9+macOS 10.12+ universal2 (ARM64, x86-64)macOS 10.12+ x86-64macOS 11.0+ ARM64

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

Hashes for logzip-0.1.0.tar.gz
Algorithm Hash digest
SHA256 010aafd48d8152cd8d353c3df9bf65043c24617517966fd1ac7b6a25a0fcf631
MD5 caf7467a2d29eb2783a9f5da5ad580e4
BLAKE2b-256 b7d38be412559d1d70969d130e6899633e9ab437459d34d33ae599e4e02edf10

See more details on using hashes here.

Provenance

The following attestation bundles were made for logzip-0.1.0.tar.gz:

Publisher: publish.yml on NailShakurov/logzip

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

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

Hashes for logzip-0.1.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 d92e7b494a3913d9636c2382d91aec563a7327a88aeb1a8cf201a4bd8551f26e
MD5 67558ffe0ae59408bb4aaebf5177ae84
BLAKE2b-256 710968f10832c169c67d65ef0490abd9f5b4acbc22114a93924e977913253c35

See more details on using hashes here.

Provenance

The following attestation bundles were made for logzip-0.1.0-cp39-abi3-win_amd64.whl:

Publisher: publish.yml on NailShakurov/logzip

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

File details

Details for the file logzip-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for logzip-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d99bccf5a032365286a7458db661216e963575a5d639f0160fdcd7ada1085463
MD5 a0928ca1e763acfae16010570e9fbe29
BLAKE2b-256 71377bef8d7e51a7de7aed3466388477dacab120829a691c7efdfdab56376fe9

See more details on using hashes here.

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

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

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

File hashes

Hashes for logzip-0.1.0-cp39-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 1d719542f00b47da964ef089ecb19034df2c0f4a135e84a36e8d02322922bdfa
MD5 4be7cb8fabbe5f0b5eec0fb1b5f4454f
BLAKE2b-256 015170bd5d9f631549ae4e7c621239e40ec2e163a9c4aebaf454f816ff976d05

See more details on using hashes here.

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

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