bronto search runs one query and exits. The query is a Bronto WHERE expression, the
same language the web appβs search bar uses. The
search syntax page on docs.bronto.io
documents it in full. Under the hood, bronto search calls the
search API.
Narrowing 502s in checkout-service
The basics
- Dataset.
-d/--datasettakes a dataset name or UUID and can be repeated to search several at once. Qualify a name that exists in more than one collection ascollection/name. Without-d, the CLI usesdefault_datasetfrom your config, or the only dataset if the account has just one. Otherwise it fails withusage_missing_datasetand lists the datasets it found.--from-exprtakes a dataset selector expression instead, for example--from-expr "log_id = '<uuid>'". - Time range.
--sincetakes a relative lookback such as30s,15m,1h,2d,1w, or1h30m. For a fixed window, pass RFC 3339 timestamps with--fromand--to;--frommust not be later than--to. With no time flag, the search covers the last 15 minutes. - Size and order.
-n/--limitcaps the number of events (1 to 10000, default 100). Results come newest first.--oldest-firstflips that, and--order-bytakes an SQL-style order such as'duration_ms DESC'. - Stdin. Pass
-as the query to read it from stdin, which helps with long queries and quoting.
bronto fields,
--select, and -x.
Filter flags instead of WHERE
The filter flags build the WHERE expression for you:model finds $model and matching is case-insensitive. It quotes the value based on its
shape: plain numbers stay bare, and everything else gets single quotes, booleans
included, because Bronto compares boolean fields as the strings 'true' and 'false'. The compiled filter is
echoed to stderr.
--show-queryprints the compiled WHERE and exits without searching.--exactturns off the fuzzy name lookup and uses field names as written. Use it in scripts.- An unknown or ambiguous field name is an error (exit code 2) that lists candidates.
Look closer at events
-x/--expand is the βclick on a rowβ view. It prints every field of every event, one
per line and untruncated, including the metadata.* fields the table hides.
-x only works with table output. When piped, add -o table. The JSON formats already
carry every field.
To see what happened around one event, use bronto context. It needs the eventβs
metadata.sequence value and its timestamp in Unix milliseconds, both visible in the
-x view:
--direction is before, after, or both (the default), and -n sets how many
events to fetch in each direction.
Find the right field names
bronto fields lists the fields seen in a dataset, each with a sample of values, so you
can spell a query correctly the first time. Add a positional filter to keep only fields
whose name contains it:
-d to scan all datasets. --since (default 1h) sets how far back to look
and -n caps the number of fields.
bronto query check validates an expression locally, without calling the API, and points
a caret at the problem:
IN, LIKE, IS NULL, and free-text terms like "slow to respond". It also warns
about an unquoted value such as level = error: the query language reads a bare word
on the right of an operator as a field name, so that query compares two fields. With
-d <dataset> it also warns about fields that havenβt appeared in that dataset
recently and suggests close matches. --strict turns those field warnings into a
failure for use in CI.
Piped or with -o json, the result is a JSON object, and - reads the query from
stdin:
Aggregate
--select picks columns or aggregate functions, and -g/--group-by groups by one or
more keys. Both are repeatable.
--slices sets the number of time buckets.
Summaries
Two flags summarize a result instead of listing events.--histogram shows when matching events happened, which answers βwhen did this start and
how big is it?β:
0, so a quiet
period before a spike is easy to see.
--patterns clusters events into message templates with counts, which shows what a noisy
dataset is mostly made of (learn more about
patterns). It clusters the parsed
message field when events have one, and the raw line otherwise:
Saved searches and the web UI
--saved <name> runs a saved search
by name or id. Query, dataset, and time flags you pass on the command line override whatβs
stored.
bronto saved-searches create, update, and delete manage them.
--url prints a link to the same query in the Bronto web app, and --open opens it in
your browser. Neither runs the query. The link targets your active org. If the CLI canβt
work out the org, set it with bronto config set org_id <uuid>.
--explain-only returns the query plan and cost estimate instead of results, as one JSON
document, so -o csv is rejected.
Search local files
--local <file> evaluates the query on your machine over an NDJSON or plain-text file.
Nothing is sent to Bronto and no API key is needed, so it works on downloaded
exports or a kubectl logs dump. Pass - to read stdin.
message_kvs.<field> key, so a bronto search -o jsonl dump answers the
same query you ran against Bronto. Plain-text lines are matched with @raw ~ 'regex'.
-o, --fields, --jq, and -n work. Matches print in file order. Dataset, time range,
select, and group-by flags donβt apply and are rejected, as are --histogram,
--patterns, --url, --open, --order-by, --oldest-first, and --saved.
The REPL
For a longer investigation,bronto repl opens a psql-style prompt. Type a WHERE
expression to run it, then edit it and run it again.
History is saved in your config directory between sessions. The REPL needs a terminal.
Piped, it exits with code 2.
To go from a question in plain English to a query, see Ask.
