Pretty Print Tailed JSONL Logs
Project description
tail-jsonl
Tail JSONL/NDJSON Logs
Background
I wanted to find a tool that could:
- Convert a stream of arbitrary JSONL logs into an easy to skim format
- 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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
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 tail_jsonl-1.4.2.tar.gz.
File metadata
- Download URL: tail_jsonl-1.4.2.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.5 CPython/3.9.13 Darwin/24.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
55970c6a7b199f21b6d3070535f41f95c7dd584ab123dbe67aea535d2758d77f
|
|
| MD5 |
8ecd649bae4a68188a653b6ebd8e3137
|
|
| BLAKE2b-256 |
3fcdce037c810f704cb18f24c3e7e0611f0e108449a639c58a3d54c69fae2c91
|
File details
Details for the file tail_jsonl-1.4.2-py3-none-any.whl.
File metadata
- Download URL: tail_jsonl-1.4.2-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.5 CPython/3.9.13 Darwin/24.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
08d5a9d1f2da2a074a3a660b37e89f76ed9364e8d5a05060432a54916458e1eb
|
|
| MD5 |
6a439a66d220d24402094dcfad8700cd
|
|
| BLAKE2b-256 |
73a260b5da30f8deadbd72c6d4529ddad4401933ec04146a26422ca45c654786
|