#json #log #viewer

app snazy

snazy is a snazzy json log viewer

16 releases (breaking)

0.50.0 Oct 6, 2022
0.10.1 May 27, 2022
0.9.1 May 23, 2022

#89 in Command line utilities

Download history 29/week @ 2022-11-23 5/week @ 2022-11-30 22/week @ 2022-12-07 38/week @ 2022-12-14 5/week @ 2022-12-21 5/week @ 2022-12-28 5/week @ 2023-01-04 16/week @ 2023-01-11 7/week @ 2023-01-18 9/week @ 2023-01-25 7/week @ 2023-02-01 46/week @ 2023-02-08 81/week @ 2023-02-15 16/week @ 2023-02-22 1/week @ 2023-03-08

114 downloads per month


3.5K SLoC

AsciiDoc 2.5K SLoC Rust 723 SLoC // 0.0% comments BASH 91 SLoC PowerShell 46 SLoC Shell 44 SLoC Elvish 43 SLoC Ruby 29 SLoC // 0.1% comments Go 3 SLoC

codecov Version AUR CICD pre-commit

snazy - a snazzy log viewer

Snazy is a simple tool to parse json or other type of logs and output them in a nice format with nice colors.

As a tekton and pipelines-as-code developer who has to dig into controller/webhook logs all the time I wanted something that is a bit easier to look in the eyes and identify error/info/warning statements easily.

You do not have to use it only with tekton but work well with projects that uses go-uber/zap library like knative and many others.

It can work as a super-"tail" too if you want to stream logs and being able to have "actions" or "highlights" on a regexp match.





Go to the release page and grab the archive or package targeting your platform.


brew tap chmouel/snazy https://github.com/chmouel/snazy
brew install snazy


cargo install snazy


With your favourite aurhelper for example yay :

yay -S snazy-bin


This repository includes a flake (see NixOS Wiki on Flakes).

If you have the nix flake command enabled (currenty on nixos-unstable, nixos-version >= 22.05)

nix run github:chmouel/snazy -- --help # your args are here

You can also use it to test and develop the source code:

nix develop # drops you in a shell with all the thing needed
nix flake check # runs cargo test, rustfmt, …


kubectl logs deployment/pod foo|docker run -i ghcr.io/chmouel/gosmee

Build from source

Snazy is built with rust, if you want to compile it directly you just need to grab the source and run cargo build.


  • Usually you use snazy by "piping" logs into it :
kubectl logs deployment/controller|snazy
  • It supports streaming too. When you have a kubectl logs -f it will just wait for input and snazzily print your logs from the stream (one line at a time).

  • you can pass one or many files on the command line to snazy and it will parse them rather than using the standard input.

  • If you do not pass a file and your input comes from https://github.com/boz/kail it will automatically detect it and print the namespace/pod[container] as prefix :


  • The flag "--kail-prefix-format" let you customize how to display the kail format, the templates {namespace}, {pod}, {container} will be replaced by its value and a "\n" will be replaced by a newline. As an example if you want to only show the current pod followed by a newline you can use the following template:

    --kail-prefix-format "{pod}\n"

    the environement variable SNAZY_KAIL_PREFIX_FORMAT let you make this setting permanent.

  • If you do not any prefix for kail you can pass the --kail-no-prefix flag.

  • If you want to highlight some patterns you can add the option -r/--regexp followed by a REGEXP and snazy will highlight it. You can have many -r switches with many regexps, and you get different highlight for each match.

  • If snazy don't recognize the line as json it will symply straight print it. Either way it will still apply regexp highlighting of the -r option or do the action commands matching (see below). This let you use it for any logs to do some regexp highlighting and action on pattern.

  • If you want to only show some specific levels, you can add the flag -f/--filter-levels to filter by level or many -f for many levels, for example, this only show warning and error from the log:

% kubectl log pod|snazy -f warning -f error
  • If you pass the flag -l/--level-symbols or set the environment variable SNAZY_LEVEL_SYMBOLS, snazy will show some pretty emojis rather than plain log level label :

snazy level symbols

  • You can customize the time printed with the --time-format flag (or the environment variable SNAZY_TIME_FORMAT), the variable respect the UNIX strftime format strings.

  • If you want to skip showing some lines you can specify the flag -S/--skip-line-regexp. When it matches the word or regexp in this value it will simply skipping printing the line. You can have multiple flags if you want to skip multiple lines.

  • You can do your own field matching with the -k/--json-keys flag, you need to pass the fields msg, level and ts. The fields target a key in a json payload specified as JSON Object notation. The description of the fileds are:

    • msg: The message text (string)
    • level: The log level (eg: info) (string)
    • ts: The timestamp, a float or a datetime.

    If any of those fields are missing the parser will fails.


    echo '{"the": {"msg": {"is": "message"}, "level": {"is": "INFO"}, "ts": [{"is": "2022-04-25T14:20:32.505637358Z"}]}}' | \
          snazy -k msg=/the/msg/is -k level=/the/level/is -k ts=/the/ts/0/is
    # => INFO  14:20:32 message
  • Snazy support action command on regexp, which mean if you have a regexp matching a message it will run an action on it. It currently supports only one action one regexp. If you specify the string "{}" it will be expanded to the matched string. For example on macOS this command will display a notification with the pipelinerun that has succeeded:

    snazy --action-regexp "pipelinerun(s)?\s*.*has success" --action-command "osascript -e 'display notification \"{}\"'"

Interactive filtering with fzf

You can go even further with unix shell pipelines, and feed snazy to fzf for interactive filtering of the stream. for example to stream everything on a kubernetes cluster with kail, transforming the logs via snazy and finally using fzf to interactively select the patter to match:

kail --since=1h | snazy | fzf +s --ansi

This will give you a prompt with fzf where you can type the query you want.

Shell completions

Shell completions are available for most shells using the command --shell-completion for example --shell-completion=zsh. Many different shell are supported. I let the reader figure out how to use them with their respective shells. Brew and RPM packges should have them auto configured for bash/fish/zsh.


  • I have seen a tool like that before with another stupid name? I used to have a python script that does the same and more called (sugarjazy) but I wanted to experiment with Rust, so I called this one snazy.
  • You missed a z to snazzy. True that. But snazy is easier to google than snazzy :p
  • Why rust? Good question, it seems the kids like it, but I still don't get it, probably because I have the feeling my code is really not very hummm "rusty". But like everything in life, you need to practice at some point to get better..
  • I have seen some of this code already 🤨, yep being a noob I much digged into the source code of (the super-duper great) sharkdp/fd



Chmouel Boudjnah <@chmouel>


~212K SLoC