Jaslog
A log reader for structured logs that handles non-json lines, displays beautifully colored logs and can filter based on the fields of the json.
- non-json lines will be displayed but marked clearly
- filters work for any fields, even fields that are not recognized
- if the structure of the JSON is not recognized, all the field will be shown on the log line
- there is no way to control which fields are displayed
- there is no way to control the formatting
It will work especially well with certain specific JSON structures (see "Supported formats").
Install
Using cargo install
Using pre-built binaries
- Download the binary from the latest release
- Put it in the folder that's part of your PATH
- Make it executable (
chmod +x
)
Usage
Basic usage:
Or using stdin:
|
CLI parameters
USAGE:
jaslog [OPTIONS] [--] [input_file]
ARGS:
<input_file> Input file to read
OPTIONS:
-f, --filter <filters> Filter the logs. Example: -f app=this -f module=+Drive (use
'+' to search within the field, use '^' to exclude within the
field)
-h, --help Print help information
-n, --lines <number_of_lines> Number of lines to read.
-V, --version Print version information
To filter, the syntax is:
<field>=<value>
: search for exact value of field<field>=+<value>
: search for value in field (suggestions of a better syntax are welcome :-P)<field>=^<value>
: search for absence of value in field (suggestions of a better syntax are welcome :-P)
You can also can also ask to read only the first n lines:
Explicitly supported formats
Pull requests to support new formats are welcome of course !
Elixir logs:
Logstash's jsonevent-layout logs:
Log4J's JSONLayout logs:
Releasing
- Update version in Cargo.toml
- Commit
- tag with
v<version>
, then push - run
cargo publish