jog
CLI tool to convert structured (JSON) log and pretty print as regular flag format
Background
Structured log, AKA. JSON line log, is great for log collectors but hard to read by developers themselves, usually during local development. This tool helps to on-the-fly convert those structured JSON log to traditional space-separated flat line log, friendly for developers. It then removes the effort to maintenain different output format for different environments (for ex. JSON log for test / production, but flat line log for local development).
Features
Feature request is welcomed, for ex. new JSON log format. Submit issue for that please.
-
Detect format, automatically
-
Most-likely know unknow format via customizeable dictionary
-
Built-in supports as many as possible formats:
-
Support Mac OSX, Windows, Linux
-
Supports customized fields
-
Supports nested JSON fields
-
Customizable output pattern
-
Customizable output colorization
-
Hightlight startup line
-
Support JSON log mixed with non-JSON log line (for ex., springboot banner) - just directly print them
-
Able to directly read many sources:
- stdin & stream
- local file
- remote file (HTTP/HTTPs/FTP/SFTP)
- k8s log
- docker-compose log
- docker log
- aggregate multiple log
-
Friendly to multi-containers log outputted by docker-compose
-
Compressed logger name - only first letters of package names are outputed
-
Filtering by level and field
Usage:
Download the executable binary to $PATH. For ex.
curl -L https://github.com/qiangyt/jog/releases/download/v0.9.0/jog.darwin -o /usr/local/bin/jog
chmod +x /usr/local/bin/jog
-
View a local JSON log file: jog sample.log
-
From stdin: cat sample.log | ./jog
-
From stdin steam: tail -f sample.log | ./jog
-
Check full usage: jog -h
Convert and view structured (JSON) log
v0.9.0
Usage:
jog [option...] <your JSON log file path>
or
cat <your JSON file path> | jog [option...]
Options:
-c, --config <config file path> Specify config YAML file path. The default is .jog.yaml or $HOME/.job.yaml
-t, --template Print a config YAML file template
-h, --help Display this information
-V, --version Display app version information
-d, --debug Print more error detail
Build
License
MIT