Search returns the newest matching events in a time range, from recent and archived data alike.
The examples assume an index named checkout and a read token.
export LOGBROOK_URL=http://127.0.0.1:3100
export LOGBROOK_READ_TOKEN='<your read token>'Run a search
logbrook query checkoutWith no time options the CLI searches the last hour and returns up to 100 events.
HTTP has no default window. from and to are required.
TO=$(jq -nr 'now * 1000 | floor')
FROM=$((TO - 3600000))
curl --fail-with-body --silent --show-error --get \
"$LOGBROOK_URL/indexes/checkout/logs" \
-H "Authorization: Bearer $LOGBROOK_READ_TOKEN" \
--data-urlencode "from=$FROM" --data-urlencode "to=$TO"Results are sorted by descending event_time, then descending id. You can’t change the order. A search with no matches returns an empty events array and a null next_cursor.
Choose a time range
from is inclusive and to is exclusive, so an event exactly at to belongs to the next window.
Use --since for a window that ends now, or --from and --to for fixed bounds.
# Relative: the last 15 minutes
logbrook query checkout --since 15m
# Absolute: Unix milliseconds, both bounds together
logbrook query checkout --from 1791334800000 --to 1791338400000--since takes a positive integer with one of these suffixes:
| Suffix | Unit |
|---|---|
ms |
milliseconds |
s |
seconds |
m |
minutes |
h |
hours |
d |
days |
w |
weeks |
--since can’t be combined with --from or --to. Give --from and --to together, with --from earlier than --to.
Send from and to as integer Unix milliseconds, not seconds. HTTP has no since parameter.
curl --fail-with-body --silent --show-error --get \
"$LOGBROOK_URL/indexes/checkout/logs" \
-H "Authorization: Bearer $LOGBROOK_READ_TOKEN" \
--data-urlencode 'from=1791334800000' \
--data-urlencode 'to=1791338400000'The server requires 0 <= from < to <= 253402300799999 and returns 400 otherwise.
A query can span at most 31 days by default. For longer periods, query adjacent windows or ask the operator to raise max_query_range_ms.
To turn a UTC timestamp into milliseconds without platform-specific date flags, use jq:
jq -nr '"2026-10-07T14:00:00Z" | strptime("%Y-%m-%dT%H:%M:%SZ") | mktime * 1000'Filter the results
Filters combine with AND.
logbrook query checkout --service api --min-level 50
logbrook query checkout --logger http --host api-1
logbrook query checkout --source production,staging
logbrook query checkout --message timeoutcurl --fail-with-body --silent --show-error --get \
"$LOGBROOK_URL/indexes/checkout/logs" \
-H "Authorization: Bearer $LOGBROOK_READ_TOKEN" \
--data-urlencode "from=$FROM" --data-urlencode "to=$TO" \
--data-urlencode 'service=api' \
--data-urlencode 'min_level=50' \
--data-urlencode 'message=timeout'URL-encode every parameter. --data-urlencode with --get does it for you.
| Filter | CLI option | HTTP parameter | Matches |
|---|---|---|---|
| Source | --source |
source |
One source, or a comma-separated list meaning OR. No spaces around commas. At most 128 sources. |
| Service | --service |
service |
Exact, case-sensitive value |
| Logger | --logger |
logger |
Exact, case-sensitive value |
| Host | --host |
host |
Exact, case-sensitive value |
| Minimum level | --min-level |
min_level |
level >= n, for a nonnegative integer n |
| Message | --message |
message |
Literal, case-sensitive substring |
| Attributes | --filter |
filter |
Top-level attribute equality. See attribute filters. |
Source scope
Without a source filter, a query covers every source your read token allows. Naming any other source returns 403. See credentials and roles.
Minimum level
There is no exact-level or maximum-level filter. Logbrook stores any nonnegative integer level. These docs use Pino’s numbers: 10 trace, 20 debug, 30 info, 40 warn, 50 error, 60 fatal. So min_level=50 returns error and fatal events.
Message text
timeout doesn’t match Timeout. %, _, *, | and parentheses are ordinary characters, so timeout|declined searches for that exact text. A comma is also literal in every filter except source.
Limits
Text filters must fit the configured field byte limit (4 KiB by default). On the HTTP log routes, the path plus query string is limited to 32,768 bytes. HTTP rejects unknown parameters, and parameters the endpoint doesn’t accept, with 400. Only search accepts limit and cursor.
Read the output
query prints a table: the range searched, one row per event, and a NEXT_CURSOR row when another page exists. The columns are time in Unix milliseconds, level, source, service and message. Missing values show as -.
Add --json for the server response, with every attribute:
logbrook query checkout --since 1h --service api --jsonSearch returns JSON:
{
"events": [{
"id": "2", "source": "production",
"event_time": 1791453599000, "received_at": 1791453600000,
"level": 50, "service": "checkout", "logger": "http",
"host": "api-1", "pid": null, "message": "payment timeout",
"attributes": { "requestId": "demo-002", "durationMs": 1200 }
}],
"next_cursor": "<opaque continuation>"
}id is a string, and event_time and received_at are Unix milliseconds. Optional fields that weren’t sent are null. See events and time.
Page size
--limit and limit set the page size: 1 to 1,000, default 100. The server’s configured maximum can be lower. To read past the first page, see pagination and export. To count matches instead of reading them, see counts, facets and histograms.