Skip to main content

logfold

CI PyPI Python versions License: MIT Rust core

Fold large logs into templates, and see what changed between two runs. A Python library and command-line tool with a Rust core, for offline analysis of big log files: no platform to run, no data to upload.

$ logfold diff before.log after.log --out diff.html --fail-on-new
before.log -> after.log: 1,265,631 -> 1,246,573 records, 2 new (2 WARN+), 1 disappeared, 3 changed, 9 unchanged, native engine, 3.41s

New templates (2)
    before      after    change  level  template
         0     44,102       new  ERROR  circuit breaker opened for upstream <IP>
         0     44,310       new  WARN   queue depth <NUM> exceeds limit on worker-<NUM>
  • Templates. user alice failed login from 10.0.0.7 and a million siblings become one line user <*> failed login from <IP> with a count, first and last timestamp, severity and an example.
  • Diff. Compare two runs (before and after a deploy, passing and failing CI job). New, disappeared and changed templates, normalized by run size. Identical inputs produce an empty diff.
  • Fast. Rust core, streaming I/O with memory independent of the file size, deterministic multi-threaded mining. See benchmarks.
  • A Python library first. analyze() and diff() return plain, immutable dataclasses; reports are JSON (versioned schema), self-contained HTML or text.
  • Extensible. Formats, reporters and diff matchers are plugins discovered through entry points; a default set (logfmt, serilog-clef, markdown, csv, jaccard) ships with logfold and logfold plugins lists, checks and installs more.

Install

pip install "logfold[cli]"

Wheels are published for Linux, macOS and Windows (Python 3.10+), so nothing is compiled on your machine.

Use

from logfold import analyze, diff

result = analyze("app.log")  # format auto-detected
for template in result.top(10):
    print(template.count, template.level, template.text)
result.to_html("report.html")

comparison = diff("before.log", "after.log")
comparison.new_templates
comparison.new_alerts  # new WARN/ERROR/FATAL templates
comparison.to_html("diff.html")
logfold analyze app.log --top 30 --out report.html          # fold one run into templates
logfold diff before.log after.log --fail-on-new-alerts      # exit code 2 in CI when something new is wrong
logfold formats                                             # list the log formats
logfold info                                                # versions and engine availability, for bug reports
logfold plugins check                                       # plugins you do not have yet; `install NAME` adds one
logfold --version

Documentation

How it relates to other tools

logfold Drain3 logdrain logdelta
Language Rust core, Python API + CLI Python Rust Rust
Template quality identical to Drain3 on Loghub-2k reference Drain Drain-based
Compare two runs yes (diff, shares normalized, recount) no no (online "template created" signal) yes (diff, several baselines, blocks)
Python API yes yes no no
Multi-threaded mining of one big file yes, deterministic no not documented for the CLI (library add is thread-safe) not documented
Reports JSON, HTML, text - text, JSON, CSV terminal, JSON, Markdown

Timings are in bench/RESULTS.md, measured with the protocol that was fixed before the runs. Template quality: python eval/quality.py (grouping accuracy on the 16 Loghub-2k datasets).

Design

Layered: a pure domain core (masking, tokenizer, Drain-compatible tree, merge) with no I/O, adapters for files and formats, an execution layer, a thin PyO3 shim, and a Python package on top. The algorithm is specified in docs/ALGORITHM.md; a pure-Python reference engine implements the same specification, and the Rust engine is tested against it for exact equality.

Development

See CONTRIBUTING.md (branches, commits, issues, definition of done).

License

MIT, see LICENSE. Copyright (c) 2026 Andrey Kilanov.

Metadata

Release files for logfold 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for logfold 0.2.0
File Size Uploaded
logfold-0.2.0.tar.gz 104.3 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for logfold 0.2.0
File
logfold-0.2.0-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details
logfold-0.2.0-cp310-abi3-musllinux_1_2_x86_64.whl CPython 3.10 abi3 Linux musl 1.2+ x86-64 Details
logfold-0.2.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details
logfold-0.2.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.10 abi3 Linux glibc 2.17+ ARM64 Details
logfold-0.2.0-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details
logfold-0.2.0-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details

Total release size: 7.7 MB

Release files / logfold-0.2.0.tar.gz

Download URL logfold-0.2.0.tar.gz
Size 104.3 kB
Tags Source
SHA-256 checksum
How to use checksums
55c26c782c3dd7bb9590fb7789869d4643ed27954f3a52b126fc8ef95b1883c8
BLAKE2b-256 checksum
How to use checksums
d0b1bb3f4f2cb3d82c816892517ecf7bf4d9ef4ea74159723d299b7445cfbb1a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 4, 2026.

Transparency log

Release files / logfold-0.2.0-cp310-abi3-win_amd64.whl

Download URL logfold-0.2.0-cp310-abi3-win_amd64.whl
Size 1.2 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
795fb7276131683c6f024fbfd313280e082d22cbc82ea2af2668d5238fde084d
BLAKE2b-256 checksum
How to use checksums
702385b2ce66cb556a3ff5c759756369ccf49f16f192d68642cc873b1cb282a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 4, 2026.

Transparency log

Release files / logfold-0.2.0-cp310-abi3-musllinux_1_2_x86_64.whl

Download URL logfold-0.2.0-cp310-abi3-musllinux_1_2_x86_64.whl
Size 1.5 MB
Tags CPython 3.10 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
caaf964ac96302a87b5946fb1ec419ef2a174a3d2b97ac3550a7616263dfdfc6
BLAKE2b-256 checksum
How to use checksums
1b40a3ae48e586529b21e63fddae0f9dd403cd48a2a50e697dd8227d351552b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 4, 2026.

Transparency log

Release files / logfold-0.2.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL logfold-0.2.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.3 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
9d67a1dabecbec2486b2c48a7bdbfced7beaab481d428b702f882c98fa41d0dd
BLAKE2b-256 checksum
How to use checksums
9e0e62f2df8b8ce6c4c66fd5b3ce5cb64b3c596b45b4f49536b68571bf343a6e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 4, 2026.

Transparency log

Release files / logfold-0.2.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL logfold-0.2.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 1.2 MB
Tags CPython 3.10 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
3b313d0df6ccabc662085106be5e9fc4729536b9b099f7cba3b065feda2204eb
BLAKE2b-256 checksum
How to use checksums
2fd7152f277c9d2073f374140f1818ca491e7f759db2b21329e7678bb5a5d5cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 4, 2026.

Transparency log

Release files / logfold-0.2.0-cp310-abi3-macosx_11_0_arm64.whl

Download URL logfold-0.2.0-cp310-abi3-macosx_11_0_arm64.whl
Size 1.1 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
c35261ad221ba928749b0a7a3b0d07df92281eba85cc03a78a38865bc6f2f352
BLAKE2b-256 checksum
How to use checksums
8ac20c070ce3c9f1306cdd7c31b4d2d558cf696ef66dc3d5d188babe5d2f8b21
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 4, 2026.

Transparency log

Release files / logfold-0.2.0-cp310-abi3-macosx_10_12_x86_64.whl

Download URL logfold-0.2.0-cp310-abi3-macosx_10_12_x86_64.whl
Size 1.2 MB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
73f28f32ed8b327515788f2bb83f132a675b239e403f2ab56805432892b3401a
BLAKE2b-256 checksum
How to use checksums
e232be3ec323a724198b12c76961d71e788089bf0cec19166d652011e5d30572
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 4, 2026.

Transparency log

Release history Release notifications | RSS feed

0.5.0

7 release files

0.4.0

7 release files

0.3.0

7 release files

0.2.1

7 release files

This release

0.2.0 This release

7 release files

0.1.0

7 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page