Querying Logs
The query command retrieves stored entries and prints them to stdout. Filter by time range or retrieve all entries.
Query Options
Section titled “Query Options”| Flag | Description | Example |
|---|---|---|
--from | Filter from time | --from 1h |
--to | Filter until time | --to "2026-01-30" |
--format | Output format | text, json, csv, hex |
--limit | Maximum entries to return | --limit 1000 |
Without filters, query returns up to 1000 entries. Use --limit 0 to return all.
Time Formats
Section titled “Time Formats”kifa query -d ./data --from 1h # Last hourkifa query -d ./data --from 30m # Last 30 minuteskifa query -d ./data --from 2d # Last 2 dayskifa query -d ./data --from 1h30m # Last 1.5 hourskifa query -d ./data --from "2026-01-29 12:00:00"kifa query -d ./data --from "2026-01-29T12:00:00Z"kifa query -d ./data --from "2026-01-29" # MidnightOutput Formats
Section titled “Output Formats”kifa query -d ./data --format text2026-01-31 18:30:00 UTC {"txn":"TXN-001","amount":5000}kifa query -d ./data --format json{"timestamp":"2026-01-31 18:30:00 UTC","data":"{...}"}kifa query -d ./data --format csvtimestamp,data"2026-01-31 18:30:00 UTC","{...}"kifa query -d ./data --format hex18276c2dae160000 7b22...Combining Filters
Section titled “Combining Filters”Time filters can be combined to select a specific window:
kifa query -d ./data --from 24h --to 1h