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.
You can install it from aur with your aurhelper, like yay :
shell
yay -S snazy
shell
brew tap chmouel/snazy https://github.com/chmouel/snazy
brew 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 install
.
You use snazy
by "piping" logs into it :
shell
kubectl logs deployment/controller|snazy
It supports streaming too, so if you do a kubectl logs -f
it would just wait
for input.
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.
Chmouel Boudjnah <@chmouel>