The json-log-viewer
converts JSON logs to a human-readable
format via stdin and offers a Scala.js browser version,
streamlining log analysis for developers and system administrators.
coursier install json-log-viewer --channel https://git.io/JvV0g
sbt stage
cat log.txt | ./json-log-viewer/jvm/target/universal/stage/bin/json-log-viewer
sbt fullLinkJS
cat log.txt | node ./json-log-viewer/js/target/scala-3.3.1/json-log-viewer-opt/main.js
~fastOptJS::webpack
Integrate json-log-viewer with k9s to view formatted JSON logs directly within the k9s interface.
Add the following to your k9s plugin file
(usually located at ~/.k9s/pluginы.yaml or, on macOS, check the plugin path with k9s info
):
plugins:
json-log-viewer:
shortCut: Ctrl-L
description: "json-log-viewer"
scopes:
- pod
- containers
command: sh
background: false
args:
- -c
- |
if [ -n "$POD" ]; then
kubectl logs $POD -n $NAMESPACE --context $CONTEXT -c $NAME -f --tail 500 | json-log-viewer; read -p "Press [Enter] to close..."
else
kubectl logs $NAME -n $NAMESPACE --context $CONTEXT -f --tail 500 | json-log-viewer; read -p "Press [Enter] to close..."
fi
- Install json-log-viewer
- Launch k9s
- Select a Pod or Container
- Press Ctrl+L to view logs formatted by json-log-viewer