To query log data on Parseable, you can use the pb query
command.
pb query run "select * from frontend limit 50" --from=1m --to=now
You can also pipe the query output to other familiar tools like jq
, grep
, cut
, awk
, sed
etc to process the JSON output. For example:
pb query run "select * from frontend" --from=1m --to=now | jq . | less
pb query run "select host, id, method, status from frontend where status = 500" --from=1m --to=now | jq . | less
pb query run "select host, id, method, status from frontend where status = 500" --from=1m --to=now | grep "POST" | jq . | less
Supported flags
Below are the flags supported by query
command.
-
from
orf
: Used to specify the start time of the query. Takes date as '2023-10-12T07:20:50.52Z' or string like '10m', '1hr'. Default value is '1m'. -
to
ort
: Used to specify the end time of the query. Takes date as '2023-10-12T07:20:50.52Z' or 'now'. Default value is 'now'. -
save-as
ors
: Used to save a filter with the specified query. Takes a filter name. -
with-time
orw
: To store the filter along with the specified time range chainsave-as
ors
flag withwith-time
orw
flag.
Manage Filters
To manage the saved filters for the active user you can use the list
command. For example:
pb query list
This will open an interactive TUI which will show the available filters along with options for applying and deleting.