Repolode
TheEdgeOfRage

TheEdgeOfRage/logfmt

A small Go command-line tool that colorizes, filters, and reformats logfmt logs piped from stdin in your terminal.

Stars
57
Forks
9
Open issues
2
Last commit
6 days ago

What is it?

logfmt CLI reads logfmt-formatted log lines from standard input and writes a more readable version to standard output. It applies syntax highlighting, moves the timestamp and level into fixed positions without their keys, and lets you choose which fields to show or hide.

Filtering is available by log level, which prints only entries at or above a chosen level such as WARN, and by exact key=value matches, so you can focus on a single API call or request. A raw mode prints only field values, similar to the Unix cut command, and an option keeps lines that have none of the selected fields.

The tool follows the Unix pipeline model, so it is typically used with commands like kubectl logs or a locally running Go service. Colors are disabled automatically when output is a pipe or file, and can be forced or turned off with flags.

Key features

  • 01Colorized output for logfmt lines, with timestamp and level in fixed positions
  • 02Filter by minimum log level such as WARN or ERROR
  • 03Filter by exact key=value pairs
  • 04Select or exclude output fields with comma-separated lists
  • 05Raw mode that prints only field values

Use cases

  • Reading local development logs from a Go service piped into the terminal
  • Inspecting Kubernetes pod logs with kubectl logs and narrowing to a specific request
  • Filtering noisy debug output down to warnings and errors

Quick start

  1. 1

    Install the logfmt CLI with Go

    go install github.com/TheEdgeOfRage/logfmt@latest
  2. 2

    Pipe your service's logs into logfmt

    go run yourservice.go | logfmt

Things to know

  • Requires a Go toolchain to install via go install.
  • Filtering is exact key=value matching only; regex and numeric filters are not supported yet.

Topics

FAQ

What is logfmt?
A small Go command-line tool that colorizes, filters, and reformats logfmt logs piped from stdin in your terminal. logfmt CLI reads logfmt-formatted log lines from standard input and writes a more readable version to standard output. It applies syntax highlighting, moves the timestamp and level into fixed positions without their keys, and lets you choose which fields to show or hide.
Is logfmt free to use? What license does it have?
logfmt is open source under the MIT license. Check the license terms before using it in commercial products.
Is logfmt still maintained?
Actively maintained. The last commit to logfmt was on Oct 14, 2026.
What can I use logfmt for?
Reading local development logs from a Go service piped into the terminal Inspecting Kubernetes pod logs with kubectl logs and narrowing to a specific request Filtering noisy debug output down to warnings and errors
How do I install logfmt?
Install the logfmt CLI with Go: go install github.com/TheEdgeOfRage/logfmt@latest Pipe your service's logs into logfmt: go run yourservice.go | logfmt
Where can I get logfmt?
The source code and installation instructions are on GitHub: https://github.com/TheEdgeOfRage/logfmt

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects