Skip to main content
jlogtail: the last lines of a file, measured from the end

jlogtail

한국어

A Rust command-line tool and Python module that read the end of large JSON Lines transcripts without loading the whole file.

Rust · Python 3.9+

pypi license

5.0 ms for the tail of a 2.18 GB transcript, against 66.5 ms for tail | jq and 1395.6 ms for a full Python read, from the saved 10-run file.

Install · Quick start · How it reads

The CLI selects recent transcript fields from a small JSONL fixture

Social preview

The demo uses synthetic transcript rows. It shows field selection and filtering, not benchmark data.

Install

cargo install --path .
pipx install jlogtail
# or: uv tool install jlogtail

The wheel installs the jlogtail command and the importable jlogtail PyO3 module. Use Cargo to install the standalone Rust CLI from this directory. Python 3.9+ is required; source builds also require Rust.

Quick start

jlogtail ~/.claude/projects/PROJECT/session.jsonl --lines 20
jlogtail ~/.codex/sessions/SESSION.jsonl --bytes 65536
jlogtail transcript.jsonl --filter payload.role=assistant --fields timestamp,payload.role
jlogtail transcript.jsonl --follow

Claude Code, Codex, and Pi transcripts use the same JSONL commands. The CLI outputs original rows by default. --fields emits a compact object with selected dotted paths. --filter PATH=VALUE compares JSON values; unquoted non-JSON values are strings. A byte window skips a partial first record but keeps it when the window starts at a line boundary. Every read path—initial read_tail, appended --follow reads, and incomplete trailing-record buffering—enforces --max-bytes (default 64 MiB). When a record exceeds --max-bytes, jlogtail skips it and prints a marker to stderr instead of growing an unbounded buffer. A row that is already unfinished when follow starts is kept from its first byte when within --max-bytes, so the first poll emits the whole row rather than a fragment.

$ jlogtail docs/demo/agents.jsonl --lines 2 --fields role,text
{"role":"assistant","text":"Checkpoint 42 finished."}
{"role":"assistant","text":"The next run is queued."}

How it reads

The reader seeks to the requested boundary, filters complete rows, then follows appended data and resets after rotation or truncation

Why

tail -n 20 file.jsonl | jq . is useful for full-file pipelines and richer JSON queries, but it reads from the start to find the last rows. This tool seeks backward to the requested records, then reads only that suffix. It is for large transcripts and repeated polling.

Measurements

On M5 Pro, macOS arm64, hyperfine ran 3 warmups and 10 measured runs per command against one 2.18 GB temporary copy. The read-only 272.9 MB source transcript was repeated eight times. Mean wall times were 5.0 ms for jlogtail, 66.5 ms for tail | jq, and 1395.6 ms for Python's full read. See the summary, raw output, and raw measurements. Results describe this copy and host only.

Warm-cache mean wall time across 10 runs: Rust reverse tail 5.0 milliseconds, tail plus jq 66.5 milliseconds, Python full read 1395.6 milliseconds

Reference

Option Meaning
--lines N, -n N Read the last N complete records; default 10
--bytes N, -c N Read N trailing bytes and drop a partial first record unless the window starts at a line boundary
--follow, -f Emit complete appended records; restart from byte 0 after replacement or truncation
--filter PATH=VALUE Keep rows whose dotted key path equals the JSON value
--fields PATH,... Emit only the selected dotted paths as a compact object
--poll-ms N Follow poll interval; default 250 ms
--max-bytes N Memory ceiling in bytes for read_tail, follow reads, and pending incomplete records; default 67108864 (64 MiB)
--keep-partial-first Keep the first partial row in a byte window
--version, -V Print the jlogtail version and exit

The Python module provides jlogtail.tail(path, lines=10, byte_window=None, max_bytes=jlogtail.DEFAULT_MAX_BYTES, keep_partial_first=False) for raw complete rows (emitting a RuntimeWarning if a record is skipped or the window hits max_bytes). jlogtail.tail_window(...) returns (meta, rows) with end_offset, max_bytes, skipped_oversized, ceiling_reached, and trailing_oversized. jlogtail.select_native(path) returns a metadata dictionary and oldest-to-newest Codex message objects. lib/native-history-tail.py preserves feno-handoff's existing one-path command and metadata output.

Limits

The benchmark and demo ran on macOS arm64. Linux and Windows builds have not been exercised. Follow compares platform file IDs and resets when it observes a shorter file. The benchmark ran on macOS arm64; Linux and Windows follow behavior has not been exercised. A filter requires valid JSON. A follow poll waits for the newline that completes each row. Records larger than --max-bytes (default 64 MiB) are skipped with a clear stderr marker (or Python RuntimeWarning and metadata count) rather than buffering past the ceiling.

Contributing

Issues and pull requests are welcome. See CONTRIBUTING.md for the build, the fixture check and the review process.

License

MIT. See LICENSE.

Metadata

Release files for jlogtail 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 jlogtail 0.2.0
File Size Uploaded Provenance Actions
jlogtail-0.2.0.tar.gz 187.0 kB Without provenance Details for jlogtail-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for jlogtail 0.2.0
File Interpreter ABI Platform Actions
jlogtail-0.2.0-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details for jlogtail-0.2.0-cp39-abi3-macosx_11_0_arm64.whl

Total release size: 489.7 kB

Release files / jlogtail-0.2.0.tar.gz

Download URL jlogtail-0.2.0.tar.gz
Size 187.0 kB
Tags Source
SHA-256 checksum
How to use checksums
1d0e6a1ce2c1892e8c5cdd165cc26356a2d95b16291a4c5208f69042fd9f2865
BLAKE2b-256 checksum
How to use checksums
01280f74b93c3a28c4dfbae8691ac0d46ce48088cd40a2108bbd847a5533a00d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.8

Release files / jlogtail-0.2.0-cp39-abi3-macosx_11_0_arm64.whl

Download URL jlogtail-0.2.0-cp39-abi3-macosx_11_0_arm64.whl
Size 302.6 kB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
47560c640f09e0b64bcf72335d978842a5001011b982ba1c3f66c42ab52cc719
BLAKE2b-256 checksum
How to use checksums
21ec61f3b574b0a20530e737e33289a04ef611efdef6efeff228f886167afb88
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.8

Security for jlogtail 0.2.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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