Snazy is a simple tool to parse json logs and output them in a nice format with nice colors.
As a tekton
developer who has to dig into controller/webhook logs I wanted
something that is a bit easier to look on the eyes and identify error/info/warning statements easily.
It's not only for tekton
but would work well with projects using go-uber/zap
library like knative
and many others.
Go to the release page and choose your archive or package for your platform.
With your favourite aurhelper like yay :
shell
yay -S snazy-bin
shell
brew tap chmouel/snazy https://github.com/chmouel/snazy
brew install snazy
shell
cargo install snazy
shell
kubectl logs deployment/pod foo|docker run -i ghcr.io/chmouel/gosmee
Snazy is using rust, if you want to compile it directly you just need to
checkout the source and run cargo build
.
You use snazy
by "piping" logs into it :
shell
kubectl logs deployment/controller|snazy
It supports streaming too. When you have a kubectl logs -f
it would just wait
for input and snazzily print your logs.
If you need to parse a file you simply can use the shell with snazy < FILE
If your input comes from https://github.com/boz/kail it will automatically detect it and print the namespace/pod[container] :
If you don't want to have the namespace/pod[container] printed you can add the
flag --kail-no-prefix
.
If you want to highlight some pattern you can add the option -r REGEXP
and
snazy
will highlight it.
If you want to only show some levels, you can add the -f option with level separated by commas, for example:
shell
% kubectl log pod|snazy -f warning,error
will only show warning and error fro the log.
You can customize the time printed with the -t
option which respect the
strftime
format
strings.
Shell completions is available for most shells in the misc/completions and it should be automatically installed with the aur/brew package.
Chmouel Boudjnah <@chmouel>