# angle-grinder

> Command-line log analysis tool that parses, filters, and aggregates log data with a pipeline query language and a live-updating terminal UI.

Stars: 3.8k · Language: Rust · License: MIT · Categories: Data

- Repository: https://github.com/rcoh/angle-grinder
- Page: https://www.trmn.sh/tools/angle-grinder

## Install

- Homebrew: `brew install angle-grinder`
- Cargo: `cargo install ag`
- Binary download (Linux MUSL): `curl -L https://github.com/rcoh/angle-grinder/releases/download/v0.18.0/agrind-x86_64-unknown-linux-musl.tar.gz \`
- Binary download (Linux MUSL): `| tar Ozxf - \`
- Binary download (Linux MUSL): `| sudo tee /usr/local/bin/agrind > /dev/null && sudo chmod +x /usr/local/bin/agrind`

## Overview

angle-grinder (binary name `agrind`) is a command-line tool for parsing and aggregating log files. It fills the gap when your logs are not in a system like Graphite, Honeycomb, Kibana, Sumo Logic, or Splunk but you still need analytics such as counts, sums, averages, min/max, percentiles, and sorting. Results update live in the terminal as input is processed. The README states it can process well above 1M rows per second, with simple pipelines reaching 5M.

Queries are a filter followed by a pipeline of operators: `agrind '<filter> | operator1 | operator2 | ...'`. Filters match lines using case-insensitive wildcards, case-sensitive quoted strings, and `AND`, `OR`, `NOT`. Parsing operators include `json`, `logfmt`, `split`, pattern-based `parse`, and `parse regex` using Rust regex syntax with named captures. Other operators include `fields`, `where`, `limit`, and field expressions (`<expr> as <name>`) with arithmetic and boolean operators. Aggregators include `count`, `sum`, `min`, `max`, `percentile`, `sort`, `total`, and `count distinct`. For example, `agrind '* | json | count by log_level'` counts JSON log lines per level.

Since v0.12.0, experimental aliases let you save pipelines in TOML files in a `.agrind-aliases` directory. These files are searched in the current directory and its parents. A query can then call them by keyword, for example `* | apache | count by status`. Since v0.9.0, `agrind` can update itself with `--self-update`. Binaries are provided for Linux and macOS, and other platforms, including Windows, can be built from source. It is aimed at developers and operators who analyze log files from the shell.

### Installation

```bash
# via Homebrew
brew install angle-grinder
```

```bash
# via Cargo
cargo install ag
```

```bash
# via Binary download (Linux MUSL)
curl -L https://github.com/rcoh/angle-grinder/releases/download/v0.18.0/agrind-x86_64-unknown-linux-musl.tar.gz \
  | tar Ozxf - \
  | sudo tee /usr/local/bin/agrind > /dev/null && sudo chmod +x /usr/local/bin/agrind
```

![angle-grinder overview](https://media.trmn.sh/cached/1bb0fde7c3a117268100ebc4c516c3969f2a015ddf44b8dc1e660d5faa610721.gif)

![JSON parsing in angle-grinder](https://media.trmn.sh/cached/b7693ccd83cef8ae9624f50d811f347f8d0fc35941a07ee7b405c345676a94c6.gif)

![Filtering logs in angle-grinder](https://media.trmn.sh/cached/b74d8201167cad8bee231f44b9026ca3fde713f4868e3a5eed472c540e93148f.gif)

## Alternatives

- [qsv](https://www.trmn.sh/tools/qsv.md): Rust CLI toolkit of composable commands for querying, transforming, validating, joining, and describing CSV, Excel, and other tabular data. (Rust, 3.8k stars)
- [jless](https://www.trmn.sh/tools/jless.md): Command-line JSON viewer with syntax highlighting, collapsible sections, and vim-inspired navigation commands (Rust, 5.5k stars)
- [jnv](https://www.trmn.sh/tools/jnv.md): Interactive terminal JSON viewer and jq filter editor with auto-completion, using the built-in jaq engine; reads files or stdin. (Rust, 6.1k stars)
- [alphai-tui](https://www.trmn.sh/tools/alphai-tui.md): Terminal stock dashboard with watchlists, candlestick charts, portfolio tracking, news, and company filings. (Rust, 88 stars)
- [htmlq](https://www.trmn.sh/tools/htmlq.md): HTML parser that uses CSS selectors to extract content from HTML files, similar to jq for JSON (Rust, 7.6k stars)

---

Canonical: https://www.trmn.sh/tools/angle-grinder
