Skip to main content

tail-jsonl

Tail JSONL/NDJSON Logs

.github/assets/demo.gif

Background

I wanted to find a tool that could:

  1. Convert a stream of arbitrary JSONL logs into an easy to skim format
  2. Clearly unwrap and display exceptions

If you are looking for more functionality, there are many good alternatives: humanlog, lnav, goaccess, angle-grinder, adapting jq, textualog, logss, tailspin, toolong, and loggo, etc.

Installation

Install with pipx, uv tool, mise, or your other tool of choice for Python packages

# Choose one:
pipx install tail-jsonl
uv tool install tail-jsonl # or: uvx tail-jsonl
mise use -g pipx:tail-jsonl

Usage

Pipe JSONL output from any file, kubernetes (such as stern), Docker, etc.

Tip: use |& to ensure that stderr and stdout are formatted (if using latest versions of zsh/bash), but all of these examples only require |

# Example piping input in shell
echo '{"message": "message", "timestamp": "2023-01-01T01:01:01.0123456Z", "level": "debug", "data": true, "more-data": [null, true, -123.123]}' |& tail-jsonl
cat tests/data/logs.jsonl |& tail-jsonl

# Optionally, pre-filter or format with jq, grep, awk, or other tools
cat tests/data/logs.jsonl | jq '.record' --compact-output |& tail-jsonl

# An example stern command (also consider -o=extjson)
stern envvars --context staging --container gateway --since="60m" --output raw |& tail-jsonl

# Or with Docker Compose (note that awk, cut, and grep all buffer. For awk, add '; system("")')
docker compose logs --follow | awk 'match($0, / \| \{.+/) { print substr($0, RSTART+3, RLENGTH); system("") }' |& tail-jsonl

Configuration

Optionally, specify a path to a custom configuration file. For an example configuration file see: ./tests/config_default.toml

echo '...' |& tail-jsonl --config-path=~/.tail-jsonl.toml

Project Status

See the Open Issues and/or the CODE_TAG_SUMMARY. For release history, see the CHANGELOG.

Contributing

We welcome pull requests! For your pull request to be accepted smoothly, we suggest that you first open a GitHub issue to discuss your idea. For resources on getting started with the code base, see the below documentation:

Code of Conduct

We follow the Contributor Covenant Code of Conduct.

Open Source Status

We try to reasonably meet most aspects of the "OpenSSF scorecard" from Open Source Insights

Responsible Disclosure

If you have any security issue to report, please contact the project maintainers privately. You can reach us at dev.act.kyle@gmail.com.

License

LICENSE

Metadata

Release files for tail_jsonl 1.4.2

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

Source distribution (sdist)

Source distribution for tail_jsonl 1.4.2
File Size Uploaded
tail_jsonl-1.4.2.tar.gz 8.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tail_jsonl 1.4.2
File Interpreter ABI Platform
tail_jsonl-1.4.2-py3-none-any.whl Python 3 none any Details

Total release size: 16.5 kB

Release files / tail_jsonl-1.4.2.tar.gz

Download URL tail_jsonl-1.4.2.tar.gz
Size 8.0 kB
Tags Source
SHA-256 checksum
How to use checksums
55970c6a7b199f21b6d3070535f41f95c7dd584ab123dbe67aea535d2758d77f
BLAKE2b-256 checksum
How to use checksums
3fcdce037c810f704cb18f24c3e7e0611f0e108449a639c58a3d54c69fae2c91
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.5 CPython/3.9.13 Darwin/24.6.0

Release files / tail_jsonl-1.4.2-py3-none-any.whl

Download URL tail_jsonl-1.4.2-py3-none-any.whl
Size 8.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
08d5a9d1f2da2a074a3a660b37e89f76ed9364e8d5a05060432a54916458e1eb
BLAKE2b-256 checksum
How to use checksums
73a260b5da30f8deadbd72c6d4529ddad4401933ec04146a26422ca45c654786
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.5 CPython/3.9.13 Darwin/24.6.0

Release history Release notifications | RSS feed

This release

1.4.2 This release

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.6

2 release files

1.2.5

2 release files

1.2.4

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.0.0

2 release files

0.0.1

2 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