Skip to content

Latest commit

 

History

History
115 lines (72 loc) · 3.75 KB

README.md

File metadata and controls

115 lines (72 loc) · 3.75 KB

pb

Dashboard fatigue is one of key reasons for poor adoption of logging tools among developers. With pb, we intend to bring the familiar command line interface for querying and analyzing log data at scale.

pb is the command line interface for Parseable Server. pb allows you to manage Streams, Users, and Data on Parseable Server. You can use pb to manage multiple Parseable Server instances using Profiles.

pb

Installation

pb is available as a single, self contained binary for Mac, Linux, and Windows. You can download the latest version from the releases page.

To install pb, download the binary for your platform, un-tar the binary and place it in your $PATH.

Usage

pb is configured with demo profile as the default. This means you can directly start using pb against the demo Parseable Server. For example, to query:

pb query -i

Profiles

To start using pb against your Parseable server, create a profile (a profile is a set of credentials for a Parseable Server instance). You can create a profile using the pb profile create command. For example:

pb profile add local http://localhost:8000 admin admin

This will create a profile named local that points to the Parseable Server at http://localhost:8000 and uses the username admin and password admin.

You can create as many profiles as you like. To avoid having to specify the profile name every time you run a command, pb allows setting a default profile. To set the default profile, use the pb profile default command. For example:

pb profile default local

Query

Query can be run in plaintext or interactive mode. Plaintext emits simple json data to stdout. Interactive mode opens a TUI based interface to view the data.

Plaintext output

By default pb sends json data to stdout.

pb query "select * from backend" --from=1m --to=now

or specifying time range in rfc3999

pb query "select * from backend" --from=2023-01-00T01:40:00.000Z --to=2023-01-00T01:55:00.000Z

You can use tools like jq and grep to further process and filter the output. Some examples:

pb query "select * from backend" --from=1m --to=now | jq .
pb query "select host, id, method, status from backend where status = 500" --from=1m --to=now | jq . > 500.json
pb query "select host, id, method, status from backend where status = 500" | jq '. | select(.method == "PATCH")'
pb query "select host, id, method, status from backend where status = 500" --from=1m --to=now | grep "POST" | jq . | less

Interactive mode

To run queries in interactive TUI mode use the -i flag with the query command. For example:

pb query "select * from backend" --from=1m --to=now -i

Live Tail

pb can be used to tail live data from Parseable Server. To tail live data, use the pb tail command. For example:

pb tail backend

You can also use the terminal tools like jq and grep to filter and process the tail output. Some examples:

pb tail backend | jq '. | select(.method == "PATCH")'
pb tail backend | grep "POST" | jq .

To stop tailing, press Ctrl+C.

Stream Management

Once a profile is configured, you can use pb to query and manage that Parseable Server instance. For example, to list all the streams on the server, run:

pb stream list

Users

To list all the users with their privileges, run:

pb user list

You can also use the pb users command to manage users.

Version

Version command prints the version of pb and the Parseable Server it is configured to use.

pb version