jog 
Command line tool to view structured (JSON) log, as regular flat line format
Background
Structured log, AKA. JSON line log, is great for log collectors but hard to read by developers themselves, usually during local development. Jog 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:
-
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 (https://github.com/qiangyt/jog/releases/) to $PATH. For ex., for Mac OSX and Linux,
sudo curl -L https://github.com/qiangyt/jog/releases/download/v0.9.12/jog.$(echo `uname -s` | tr A-Z a-z) -o /usr/local/bin/jog
sudo 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
Usage:
jog [option...]
or
cat | jog [option...]
Examples:
- view a json log: jog app-20200701-1.log
- view a json log with specified config file: jog -c another.jog.yml app-20200701-1.log
- view docker-compose log: docker-compose logs | jog
- print the default template: jog -t
- view the json log with WARN level foreground color set to RED: jog -cs fields.level.enums.WARN.color=FgRed app-20200701-1.log
- view the WARN level config item: jog -cg fields.level.enums.WARN
Options:
-c, --config Specify config YAML file path. The default is .jog.yaml or $HOME/.jog.yaml
-cs, --config-set = Set value to specified config item
-cg, --config-get Get value to specified config item
-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