tally aggregates log lines from stdin in real time and shows a ranked top list.
Unlike sort | uniq -c | sort -nr, you can see “what’s hot right now” as the stream flows.
- Real-time aggregation: continuously updated Top N while the stream is flowing
- TUI display: bar-chart ranking in the terminal
- Fast: Rust-based and optimized for high throughput
- Simple: works as a drop-in pipe with no query language
- Live monitoring of popular paths in access logs
- Detect spikes in error levels or messages
- First-pass troubleshooting for fast-moving logs
# Cargo (Rust)
cargo install rtally
# Homebrew / binary releases are plannedNote: crates.io package name may differ from binary name. See Cargo.toml.
tail -f access.log | cut -d ' ' -f 7 | tally# 7th field (space-separated)
tail -f access.log | tally -f 7
# 3rd field (comma-separated)
tail -f access.log | tally -f 3 -d ','-f, --field <N>: Aggregate the Nth field after splitting-d, --delimiter <CHAR>: Delimiter character (1 char)-n, --top <N>: Show top N entries (default: 10)--interval <MS>: Refresh interval in ms (clamped to 50–2000)--no-color: Disable ANSI colors (overridesNO_COLOR)--json <KEY>: Aggregate JSON key (e.g.path)--width <N>: Fixed table width (min 40)--no-final: Disable final text output after EOF
- Input is processed as UTF-8; invalid bytes are replaced and processing continues
- Set
NO_COLOR=1to disable ANSI color output - Table width is fixed at startup unless
--widthis specified - Interactive keys are enabled only when stdin is a TTY
# Release build
cargo build --release
# Quick check with sample input
time cat samples/bench.log | ./target/release/tally -f 1 -d '=' -n 5 --interval 200 > /dev/null# 1) Popular paths in access log
tail -f access.log | tally -f 7
# 2) Second column in CSV
tail -f data.csv | tally -f 2 -d ','
# 3) JSON path aggregation
cat /logs/access.log | tally --json path
# 3) Top 5 with faster refresh
tail -f access.log | tally -f 7 -n 5 --interval 100Q. The output does not refresh
A. Check if --interval is too large and whether input is actually flowing.
Q. The aggregation looks wrong
A. -f is 1-based. Check delimiter settings and how consecutive delimiters are treated.
Q. I see mojibake
A. Ensure the input is UTF-8; verify your LC_ALL.
# Build
cargo build
# Test
cargo test
# Format
cargo fmt
# Lint
cargo clippy- Review
ROADMAP.mdandPRD.mdfirst - See
CONTRIBUTING.mdfor development workflow and rules
CONTRIBUTING.mdCODE_OF_CONDUCT.mdSECURITY.mdCHANGELOG.mdRELEASE.mdLICENSE
- MIT License (
LICENSE)
- See
SECURITY.mdfor reporting
tally は標準入力のログをリアルタイムで集計し、頻出項目をランキング表示するCLIツールです。
sort | uniq -c | sort -nr のように全件読み込み完了を待たず、実行直後から「今多いもの」を見られます。
- リアルタイム集計: 入力が流れ続けてもトップNが更新され続ける
- TUI表示: バーチャート付きの見やすいランキング
- 高速: Rust実装で高スループットに対応
- シンプル: パイプで繋ぐだけ、複雑なクエリ不要
- アクセスログの人気パスをライブ監視
- 失敗ステータスやエラー文言の急増を検知
- バッチでは追いにくいトラブルシューティングの一次調査
# Cargo (Rust)
cargo install rtally
# 将来的に Homebrew / バイナリ配布を予定※ crates.ioのパッケージ名はバイナリ名と異なる場合があります(Cargo.toml を参照)。
tail -f access.log | cut -d ' ' -f 7 | tally# 空白区切りの7番目を集計
tail -f access.log | tally -f 7
# カンマ区切りの3番目を集計
tail -f access.log | tally -f 3 -d ','-f, --field <N>: 区切り文字で分割したN番目の要素を集計-d, --delimiter <CHAR>: 区切り文字を指定(1文字)-n, --top <N>: 上位N件のみ表示(デフォルト: 10)--interval <MS>: 描画更新間隔(ミリ秒、50〜2000に丸め)--no-color: ANSIカラーを無効化(NO_COLORを上書き)--json <KEY>: JSONのキーを集計(例:path)--width <N>: テーブル幅を固定(最小40)--no-final: EOF後の最終テキスト出力を無効化
- UTF-8として処理し、不正なバイト列は置換して継続処理する
NO_COLOR=1を設定するとANSIカラーを無効化できる- テーブル幅は起動時に固定され、
--widthで指定可能 - インタラクティブ操作はstdinがTTYのときのみ有効
# リリースビルド
cargo build --release
# サンプル入力での簡易計測
time cat samples/bench.log | ./target/release/tally -f 1 -d '=' -n 5 --interval 200 > /dev/null# 1) アクセスログの人気パス
tail -f access.log | tally -f 7
# 2) CSVの2列目を集計
tail -f data.csv | tally -f 2 -d ','
# 3) JSONのpathだけ集計
cat /logs/access.log | tally --json path
# 3) 上位5件だけ表示、更新間隔を短く
tail -f access.log | tally -f 7 -n 5 --interval 100Q. 出力が更新されません
A. --interval が大きすぎないか確認してください。入力が流れているかも確認してください。
Q. 集計結果が期待と違います
A. -f は1始まりです。区切りが空白か -d 指定か、連続区切り時の空フィールド扱いを確認してください。
Q. 文字化けします
A. UTF-8以外の入力が混在していないか、LC_ALL の設定を確認してください。
# ビルド
cargo build
# テスト
cargo test
# フォーマット
cargo fmt
# リント
cargo clippy- まずは
ROADMAP.mdとPRD.mdを確認してください - 開発フローとルールは
CONTRIBUTING.mdを参照してください
CONTRIBUTING.mdCODE_OF_CONDUCT.mdSECURITY.mdCHANGELOG.mdRELEASE.mdLICENSE
- MIT License(
LICENSE)
- 報告手順は
SECURITY.mdを参照してください