https://github.com/solidiquis/grits
A simple line-text formatter that makes it simple to parse, filter, and format live logs turning noise into meaningful insights.
https://github.com/solidiquis/grits
cli command-line command-line-interface command-line-tool commandline regex regexp rust
Last synced: about 2 months ago
JSON representation
A simple line-text formatter that makes it simple to parse, filter, and format live logs turning noise into meaningful insights.
- Host: GitHub
- URL: https://github.com/solidiquis/grits
- Owner: solidiquis
- License: mit
- Created: 2025-01-11T17:58:56.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-21T07:25:51.000Z (over 1 year ago)
- Last Synced: 2025-12-28T10:17:26.699Z (5 months ago)
- Topics: cli, command-line, command-line-interface, command-line-tool, commandline, regex, regexp, rust
- Language: Rust
- Homepage:
- Size: 43.9 MB
- Stars: 57
- Watchers: 1
- Forks: 2
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-cli-apps-in-a-csv - grits - A simple line-text formatter that makes it simple to parse, filter, and format live logs turning noise into meaningful insights. (<a name="text-processing"></a>Text processing)
- awesome-cli-apps - grits - A simple line-text formatter that makes it simple to parse, filter, and format live logs turning noise into meaningful insights. (<a name="text-processing"></a>Text processing)
README
# Grits
[](https://github.com/solidiquis/grits/actions)
[](https://crates.io/crates/grits)
[](https://crates.io/crates/grits)
A simple line-text formatter that makes it simple to parse, filter, and format live logs turning noise into meaningful insights.

An example of Grits in action: the left pane shows Grits being applied, and the right pane displays the raw logs.
* [Installation](#installation)
* [Documentation](#documentation)
* [Contributing](#contributing)
* [Donating](#donating)
* [FAQ](#faq)
At its core, `grits` applies regular expressions with named captures to input lines. These captures are then available as variables
(a.k.a. anchors) which can then be used in a `grits` template string. The template string supports text-alignment, colorization,
as well as other attributes you'd expect using ANSI escape sequences.
The following example demonstrates how to apply `grits` to `tcpdump` to extract an output line's timestamp (`ts`) and
a packet's source (`src`) and destination (`dst`) IP address:
```bash
tcpdump -nn | grits -- \
-p '^(?[^ ]+)' \
-p 'IP\w? (?[^ ]+)' \
-p '> (?[^ ]+):' \
-t '[{(cyan|bold):ts}] {(green|underlined):"src"}={(lalign(45)):src} {(yellow|underlined):"dst"}={dst}'
```

The top pane in the above screenshot is the raw output of tcpdump while the bottom pane shows the output being piped into grits.
## Installation
### crates.io
```bash
cargo install grits
```
### cURL
```bash
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/solidiquis/grits/releases/download/v0.3.0/grits-installer.sh | sh
```
### Powershell
```bash
powershell -ExecutionPolicy Bypass -c "irm https://github.com/solidiquis/grits/releases/download/v0.3.0/grits-installer.ps1 | iex"
```
### Manual installation
Check the [releases page](https://github.com/solidiquis/grits/releases) for prebuilt binaries.
## Documentation
The documentation for `grits` can be found [here](./docs/help.md). It is also available in the CLI via `--help`.
## Contributing
All well-intentioned forms of contributions are welcome.
## Donating
If you like this tool, please consider [buying me a coffee](https://buymeacoffee.com/O3nsHqb7A9). Much appreciated!
## FAQ
- Q: **Have you heard of lnav? Why should I use grits over lnav?**
- A: I have heard of [lnav](https://github.com/tstack/lnav) but I haven't used it. Users are encouraged to use both to see what best fits their needs.
- Q: **Why is this called grits?**
- A: I was really craving shrimp & grits while writing this on a plane going to South Korea. Also, checkout my Spotify playlist called [Melancholy with a side of Grits](https://open.spotify.com/playlist/2bsBVlDXS1yWwUjxuSRtd2?si=44122d2dc11b4a90).