JL(1)

πŸ“¦
version 0.1.0+git20220705+8771236337c6 Β· 5 versions
, in ubuntu noble, ubuntu questing

πŸ’– JL(1) β€” the manual, but make it cute πŸ’–

okay bestie, sit down, hydrate, and let me tell you about jl, a little icon from the JL(1) manual. she's a command-line girlie and she is so good at her job. 🫢

✨ NAME ✨

jl β€” pretty-print JSON logs πŸ’…


🌸 SYNOPSIS 🌸

jl [options...] [file]

πŸ¦‹ DESCRIPTION πŸ¦‹

so like. jl is a parser and formatter for JSON logs, and her whole entire purpose is making machine-readable JSON logs human readable again. which is honestly iconic of her. ✨

she consumes JSON logs from stdin and writes human-readable logs to stdout. that's the whole vibe. to use her, you literally just pipe your JSON logs through her:

./my-app-executable | jl
cat app-log.json | jl

and yes, she can also read from a file, she's flexible like that:

jl my-app-log.json
🫢 quick honesty moment: jl herself does not support following log files. no cap. but because she can consume from a pipe, you can just hand that job to tail:
tail -F app-log.json | jl

and if you wanna page through her colorised output, you can use less with the -R flag:

jl my-app-log.json | less -R

πŸ‘‘ OPTIONS πŸ‘‘

here's the summary of options, bestie. she doesn't have many but she uses every single one.

  • -color auto|yes|no β€” set the color mode. the options are "auto", "yes", and "no". "auto" disables color if stdout is not a TTY (default: "auto")
  • -format compact|logfmt β€” the formatter for logs. the options are "compact" and "logfmt" (default: "compact")
  • -truncate[=false] β€” whether to truncate strings in the compact formatter (default: true)

πŸŽ€ FORMATTERS πŸŽ€

jl currently supports two formatters, with plans to make the formatters customizable. so like, watch this space ig πŸ’…

the default is -format compact, which extracts only important fields from the JSON log β€” like message, timestamp, level β€” colorises them and presents them in an easy to skim way. it drops unrecognised fields from the logs. gone. not invited. πŸšͺ

the other option is -format logfmt, which formats the JSON logs in a way that closely resembles logfmt. this option emits all fields from each log line. no field left behind, fr fr.

and here's the sweet part: both formatters echo non-JSON log lines as-is. 🫢


🌈 LOG FORMATS 🌈

JSON application logs tend to have some core shared fields β€” like level, timestamp, and message β€” which jl tries to discover and prioritise for formatting. for now, the following formats work best with jl. for string fields other than level, only the keys matter. ✨

other formats can be used after preprocessing with jq. (iykyk)

  • Java-like:
{
  "level": "error",
  "timestamp": "2019-02-02 15:39:45",
  "logger": "HelloWorldService",
  "thread": "main",
  "message": "hello world",
  "exception": "java.lang.IllegalArgumentException: The world isn't here\n...stacktraces..."
}
  • Go/Logrus-like:
{
  "level": "error",
  "timestamp": "2019-02-02 15:39:45",
  "msg": "hello world",
  "error": "hello error",
  "stack": "\nhello\n\thello.go\nworld\n\tworld.go"
}

Copyright (C) 2019-2023 Yunchi Luo

License: MIT/Expat

this manual page is based on the README document by the author. it was reformatted and adapted by Andrej Shadura <andrewsh@debian.org> for the Debian project, and is distributed under the same license as the original project. slay. 🫢


⭐ SEE ALSO ⭐


πŸŽ€ and that's the whole page bestie!! this was the JL(1) manual, and the version/date on the tin is 2023-08-24. go forth and make your logs cute. periodt. πŸ’–βœ¨πŸ¦‹πŸŒΈπŸ’…
πŸ“¦ where this page comes from