Skip to main content

Tail JSONL Logs

Project description

tail-jsonl

Tail JSONL Logs

Background

I wanted to find a tool that could:

  1. Convert a stream of JSONL logs into a readable logfmt-like output with minimal configuration
  2. Show exceptions on their own line

I investigated a lot of alternatives such as: humanlog, lnav, goaccess, angle-grinder, jq, textualog, etc. but nothing would both cleanly format the JSONL data and show the exception.

Installation

Install with pipx

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

# Optionall, 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

.github/assets/demo.gif

Configuration

Optionally, specify a path to a custom configuration file. See an example configuration file at: 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tail_jsonl-1.1.2.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

tail_jsonl-1.1.2-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file tail_jsonl-1.1.2.tar.gz.

File metadata

  • Download URL: tail_jsonl-1.1.2.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.11.1 Darwin/22.3.0

File hashes

Hashes for tail_jsonl-1.1.2.tar.gz
Algorithm Hash digest
SHA256 32393d2ef9a8ea053d2bc63eefc326cad43b0a69e8a2c43daaaed0b4f5d5c3b9
MD5 ff4ef9237dda9e137d67f72f4d1855ba
BLAKE2b-256 097f222abd2c7147ca73f2b11af808a706a76cfd6cbd88f1519eaab5ab9a57fa

See more details on using hashes here.

File details

Details for the file tail_jsonl-1.1.2-py3-none-any.whl.

File metadata

  • Download URL: tail_jsonl-1.1.2-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.11.1 Darwin/22.3.0

File hashes

Hashes for tail_jsonl-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 30e0c61075c9d9fbc730bed215194de5cfa7afe0f707d7f6df70870f8fec718a
MD5 64034aa3c2458a2af40d4370b8cf419c
BLAKE2b-256 e7ac7046bda83349e68a58e6e38650bc78e1a39055f3e45417412751b1647570

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page