File-based log storage with ripgrep-powered search for Ruby. Dump structured logs to disk, then search them with fast regex queries and paginate with head/tail. No Elasticsearch. No external services.
Part of the Trifle ecosystem.
gem 'trifle-logs'require 'trifle/logs'
Trifle::Logs.configure do |config|
config.driver = Trifle::Logs::Driver::File.new(path: './logs')
config.formatter = Trifle::Logs::Formatter::Json.new
endTrifle::Logs.dump('orders', 'Order #1234 processed successfully')
Trifle::Logs.dump('orders', 'Payment confirmed for $49.90')result = Trifle::Logs.searcher('orders', pattern: 'Payment').perform
result.data
#=> [{ "type" => "match", "data" => { "lines" => { "text" => "Payment confirmed for $49.90\n" }, ... } }]- File-based storage. Simple, reliable, no external dependencies.
- Fast search. Uses ripgrep for high-performance regex queries.
- Flexible formatting. JSON, text, and timestamp formatters.
- Pagination. Head/tail navigation through log files.
- Structured logging. Scope and metadata support.
- JSON. Structured output with timestamps and scope.
- Text. Plain text for human readability.
- Timestamp. Automatic timestamping on all entries.
Full guides and API reference at docs.trifle.io/trifle-logs
| Component | What it does |
|---|---|
| Trifle App | Dashboards, alerts, scheduled reports, AI-powered chat. |
| Trifle::Stats | Time-series metrics for Ruby (Postgres, Redis, MongoDB, MySQL, SQLite). |
| Trifle CLI | Terminal access to metrics. MCP server mode for AI agents. |
| Trifle::Traces | Structured execution tracing for background jobs. |
| Trifle::Docs | Map a folder of Markdown files to documentation URLs. |
Bug reports and pull requests are welcome on GitHub at https://github.com/trifle-io/trifle-logs.
The gem is available as open source under the terms of the MIT License.