Pretty Print Tailed JSONL Logs
Project description
tail-jsonl
Tail JSONL Logs
Background
I wanted to find a tool that could:
- Convert a stream of JSONL logs into a readable
logfmt
-like output with minimal configuration - Show exceptions on their own line
I investigated a lot of alternatives such as: humanlog, lnav, goaccess, angle-grinder, jq, textualog, logss, etc. but nothing would both cleanly format the JSONL data and show the exception.
Installation
pipx install tail-jsonl
Usage
Pipe JSONL output from any file, kubernetes (such as stern), Docker, etc.
# 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
File details
Details for the file tail_jsonl-1.2.6.tar.gz
.
File metadata
- Download URL: tail_jsonl-1.2.6.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.7 Darwin/24.0.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a447ba24d8f925e5f806e6048dd079af94e99069ec94594f1d3960cd7c7e5c32 |
|
MD5 | 44917e972751845f3311914b5cd92b79 |
|
BLAKE2b-256 | e0e17c2a02532759fa47c682e1a53bcfc84cf70c584f3d467bc544914077acf2 |
File details
Details for the file tail_jsonl-1.2.6-py3-none-any.whl
.
File metadata
- Download URL: tail_jsonl-1.2.6-py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.7 Darwin/24.0.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95f1b63c0f3ad2510d7f20a46a1c45e13f715a25b816e1c467b1b1ed96f0121b |
|
MD5 | e368b1aa400cd6fe9c0de5ab24ef0f0a |
|
BLAKE2b-256 | cb210522d50c819aaa28ba34d9c36631f90762661317e9de713cba33c4d7a445 |