https://github.com/kellpossible/format-json-log
A command line tool to format format json structured log message lines from stdin into ANSI coloured stdout.
https://github.com/kellpossible/format-json-log
Last synced: 8 months ago
JSON representation
A command line tool to format format json structured log message lines from stdin into ANSI coloured stdout.
- Host: GitHub
- URL: https://github.com/kellpossible/format-json-log
- Owner: kellpossible
- License: mit
- Created: 2023-06-23T06:59:10.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-07-19T22:44:52.000Z (almost 3 years ago)
- Last Synced: 2025-06-06T11:07:18.466Z (12 months ago)
- Language: Rust
- Size: 9.77 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# `format-json-log`
A command line tool to format format json structured log message lines from stdin into ANSI coloured stdout.
## Installation
Install using `cargo install format-json-log`.
## Usage
```
Usage: format-json-log [OPTIONS]
Options:
-m, --message-pointer
JSON pointer to the message string
[default: /fields/message]
-t, --timestamp-pointer
JSON pointer to the timestamp string
[default: /timestamp]
-l, --level-pointer
JSON pointer to the log level string
[default: /level]
-f, --format
What output format to use
[default: line]
Possible values:
- line: Similar to what `tracing_subscriber` outputs
- json: Coloured json, with a level heading per line
-h, --help
Print help (see a summary with '-h')
```
## `k9s` Plugin
This tool was originally designed to be used to format json log messages as a plugin in `k9s`.
In `~/.config/k9s/plugin.yml` put the following:
```yaml
plugin:
formatjsonlog:
shortCut: Shift-L
description: "attach (pretty)"
scopes:
- po
command: bash
args:
- "-i"
- "-c"
- "kubectl logs -f $NAME -n $NAMESPACE --context $CONTEXT | format-json-log"
```