woodchipper

CircleCI

Follow, transform, and explore all your unwieldly microservice logs from the terminal.

Quick Start

  1. Grab a pre-built binary from the releases page or run:

    bash cargo install woodchipper

    See the install page for detailed instructions.

  2. Follow some logs: bash tail -f /var/log/my-app.log | woodchipper

  3. Use the kubectl plugin wrapper script and watch some pods:

    bash kubectl woodchipper -n my-namespace app=my-app

Usage

Pipe any logs to woodchipper:

bash cat my-log.txt | woodchipper

This opens the interactive viewer by default. Use up, down, page up, page down, home, and end to navigate.

woodchipper also follows any streaming output: bash ./some-long-running-script.sh | woodchipper

When piped, woodchipper automatically outputs nicely formatted plaintext, appropriate for sharing:

bash ./some-hard-to-read-json-logs.sh | woodchipper | cat

Alternatively, if you'd just like to print the colorized logs to your terminal: bash ./logs.sh | woodchipper -r styled

If you don't like the interactive viewer but still want a pager, try less: bash cat logs.txt | woodchipper -r styled | less

(try less -R if your less doesn't pass through ANSI escapes by default)

Interactive Viewer

The interactive viewer provides an improved pager with regex searching and filtering. It's enabled by default if woodchipper is attached to a tty.

A number of keyboard shortcuts are available:

The interactive viewer works best with terminal emulators that treat mouse wheel input as up / down keypresses when in alternate screen mode. KDE's Konsole behaves this way by default, and this may be enabled in iTerm2 in Preferences -> Advanced -> Mouse -> "Scroll wheel sends arrow keys when in alternative screen mode". An option to capture mouse events on all terminals may be added in the future, however doing so disables text selection and isn't ideal.

kubectl plugin

For kubectl 1.13+, read more

To make full use of the Kubernetes integration:

Woodchipper uses kubectl proxy to access the Kubernetes API, so it can connect to your cluster if kubectl can.

To follow a pod named my-pod-1234, run: bash kubectl woodchipper -n my-namespace my-pod-1234

Alternatively, if you don't want to use the kubectl plugin, this is equivalent: bash woodchipper --reader=kubernetes -n my-namespace my-pod-1234

Woodchipper matches pods continually using substrings, so a partial pod name will follow pods even between restarts or deployment upgrades: bash woodchipper --reader=kubernetes -n my-namespace my-pod

Multiple substrings can be used: bash kubectl woodchipper -n my-namespace my-pod my-other-pod

Alternatively, if you give it a label-like selector, it will perform a label query: bash kubectl woodchipper -n my-namespace app=my-app

Note that only one label selector may be used at a time.

Woodchipper honors your configured kubectl default namespace, so you can leave off -n my-namespace if kubectl is configured to use it already. Alternatively, the WD_NAMESPACE environment variable can be set to override the default.

Supported Log Formats

Woodchipper can parse, format, and stylize any of the following logs, potentially mixed together:

Similar Projects

Contributing

Bug reports, feature requests, and pull requests are welcome! Be sure to read though the [code of conduct] for some pointers to get started.

Note that - as mentioned in the code of conduct - code contributions must indicate that you accept the Developer Certificate of Origin, essentially indicating you have rights to the code you're contributing and that you agree to the project's license (MIT). With the Git CLI, simply pass -s to git commit:

bash git commit -s [...]

... and Git will automatically append the required Signed-off-by: ... to the end of your commit message.

Additionally, the design documentation may be a helpful resource for understanding how woodchipper works.