Skip to content

Commit c3dd287

Browse files
committed
update README with plugin prerequisites
1 parent 1f7ccf1 commit c3dd287

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

README.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ cat log.txt | node ./json-log-viewer/js/target/scala-3.3.1/json-log-viewer-opt/m
5050

5151
Integrate json-log-viewer with k9s to view formatted JSON logs directly within the k9s interface.
5252

53+
### Prerequisites
54+
For the plugin to work correctly, the following must be installed on your system:
55+
1. **coursier** - Used to download and run `json-log-viewer` if it's not installed.
56+
2. **json-log-viewer** (optional) - If already installed, the plugin will use it directly; otherwise, it will fall back to using `coursier` to launch it.
57+
58+
### Installation
5359
Add the following to your k9s plugin file
5460
(usually located at ~/.k9s/plugins.yaml or, on macOS, check the plugin path with `k9s info`):
5561

@@ -66,10 +72,16 @@ plugins:
6672
args:
6773
- -c
6874
- |
75+
if command -v json-log-viewer >/dev/null 2>&1; then
76+
VIEWER_COMMAND="json-log-viewer"
77+
else
78+
VIEWER_COMMAND="coursier launch ru.d10xa:json-log-viewer_3:latest.release"
79+
fi
80+
6981
if [ -n "$POD" ]; then
70-
kubectl logs $POD -n $NAMESPACE --context $CONTEXT -c $NAME -f --tail 500 | json-log-viewer; read -p "Press [Enter] to close..."
82+
kubectl logs $POD -n $NAMESPACE --context $CONTEXT -c $NAME -f --tail 500 | $VIEWER_COMMAND; read -p "Press [Enter] to close..."
7183
else
72-
kubectl logs $NAME -n $NAMESPACE --context $CONTEXT -f --tail 500 | json-log-viewer; read -p "Press [Enter] to close..."
84+
kubectl logs $NAME -n $NAMESPACE --context $CONTEXT -f --tail 500 | $VIEWER_COMMAND; read -p "Press [Enter] to close..."
7385
fi
7486
```
7587

0 commit comments

Comments
 (0)