Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/koenbollen/jl
jl — JSON Logs, a development tool for working with structured JSON logging.
https://github.com/koenbollen/jl
cli json json-logs logging logs structured-logging
Last synced: about 1 month ago
JSON representation
jl — JSON Logs, a development tool for working with structured JSON logging.
- Host: GitHub
- URL: https://github.com/koenbollen/jl
- Owner: koenbollen
- License: isc
- Created: 2017-10-16T14:38:27.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2024-04-05T10:55:04.000Z (8 months ago)
- Last Synced: 2024-06-20T17:35:21.124Z (6 months ago)
- Topics: cli, json, json-logs, logging, logs, structured-logging
- Language: Go
- Size: 112 KB
- Stars: 235
- Watchers: 5
- Forks: 12
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-cli-tui-software - koenbollen/jl - jl — JSON Logs, a development tool for working with structured JSON logging. (<a name="data"></a>data)
README
# ![jl — JSON Logs](.github/logo.png)
[![Go Report Card](https://goreportcard.com/badge/github.com/koenbollen/jl)](https://goreportcard.com/report/github.com/koenbollen/jl)
**`jl` is a development tool for working with structured JSON logging.**
Modern applications quite often use structured logging instead of simple log
messages. This is preferable for computer systems but not for humans. `jl` will
help development by translating structured message into old-fashioned log lines.## Examples
A code snippets says more than a thousand words:
$ myprogram
{"message": "Hello, world!!", "severity": "info"}
{"message": "skipping file", "severity": "warn", "file": "empty.txt"}$ myprogram | jl
INFO: Hello, world!!
WARNING: skipping file [file=empty.txt]([more examples](https://github.com/koenbollen/jl/tree/master/examples))
## Installation
#### macOS:
```bash
$ brew install koenbollen/public/jl
$ echo '{"msg": "It works!"}' | jl
It works!
```#### Linux:
```bash
$ curl -LO https://github.com/koenbollen/jl/releases/download/v1.4.0/jl_linux_amd64
$ sudo install jl_linux_amd64 /usr/bin/jl && rm jl_linux_amd64
$ echo '{"msg": "It works!"}' | jl
It works!
```#### Others:
Alternatively you can fetch a binary from the
[latest release](https://github.com/koenbollen/jl/releases) or install the
latest development version from source: `go install github.com/koenbollen/jl@latest` (requires Go 1.17+).## Usage
```
Usage:
jl [options] [FILE...]Options:
-h, --help Show this screen.
--version Show version.Output Options:
--color Force colorized output
--no-color Don't colorize output
--skip-prefix Skip printing truncated bytes before the JSON
--skip-suffix Skip printing truncated bytes after the JSONFormatting Options:
--skip-fields Don't output misc json keys as fields
--max-field-length Any field, exceeding the given length (including field name) will be ommitted from output. Use 0 to remove the length limit [default: 30]
--include-fields , -f Always include these json keys as fields, no matter the length (comma separated list)
--exclude-fields Always exclude these json keys (comma separated list)You can add any option to the JL_OPTS environment variable, ex:
export JL_OPTS="--no-color"
```## Compatibility
`jl` tries to dynamically parse the lines to support as many well
known formats as possible.Is `jl` not compatible with your structured logging? Please let me
know by [creating an issue](https://github.com/koenbollen/jl/issues/new).