Skip to content

Commit c11aaf6

Browse files
authored
Update the readme to include tail command (#35)
1 parent 106b4ae commit c11aaf6

File tree

1 file changed

+30
-13
lines changed

1 file changed

+30
-13
lines changed

README.md

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,19 @@ pb is the command line interface for [Parseable Server](https://github.com/parse
1010

1111
pb is available as a single, self contained binary for Mac, Linux, and Windows. You can download the latest version from the [releases page](https://github.com/parseablehq/pb/releases/latest).
1212

13-
To install pb, download the binary for your platform and place it in your `$PATH`. For example, on Linux:
14-
15-
```bash
16-
wget https://github.com/parseablehq/pb/releases/download/v0.1.0/pb_linux_amd64 -O pb
17-
chmod +x pb && mv pb /usr/local/bin
18-
```
13+
To install pb, download the binary for your platform, un-tar the binary and place it in your `$PATH`.
1914

2015
## Usage
2116

2217
pb is configured with `demo` profile as the default. This means you can directly start using pb against the [demo Parseable Server](https://demo.parseable.io). For example, to query:
2318

2419
```bash
25-
pb query -i
20+
pb query -i
2621
```
2722

2823
### Profiles
2924

30-
To start using pb against your Parseable server, you need to 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:
25+
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:
3126

3227
```bash
3328
pb profile add local http://localhost:8000 admin admin
@@ -43,12 +38,14 @@ pb profile default local
4338

4439
### Query
4540

41+
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.
42+
4643
#### Plaintext output
4744

4845
By default `pb` sends json data to stdout.
4946

5047
```bash
51-
pb query "select * from backend" --from=10m --to=now
48+
pb query "select * from backend" --from=1m --to=now
5249
```
5350

5451
or specifying time range in rfc3999
@@ -57,20 +54,40 @@ or specifying time range in rfc3999
5754
pb query "select * from backend" --from=2023-01-00T01:40:00.000Z --to=2023-01-00T01:55:00.000Z
5855
```
5956

60-
Query command outputs data to stdout. Output json is not beautified. Use tool like `jq` to format and filter json output.
57+
You can use tools like `jq` and `grep` to further process and filter the output. Some examples:
6158

6259
```bash
63-
pb query "select * from backend" --from=10m --to=now | jq .
60+
pb query "select * from backend" --from=1m --to=now | jq .
61+
pb query "select host, id, method, status from backend where status = 500" --from=1m --to=now | jq . > 500.json
62+
pb query "select host, id, method, status from backend where status = 500" | jq '. | select(.method == "PATCH")'
63+
pb query "select host, id, method, status from backend where status = 500" --from=1m --to=now | grep "POST" | jq . | less
6464
```
6565

6666
#### Interactive mode
6767

68-
To run query/view data in interactive TUI mode use
68+
To run queries in interactive TUI mode use the `-i` flag with the query command. For example:
69+
70+
```bash
71+
pb query "select * from backend" --from=1m --to=now -i
72+
```
73+
74+
### Live Tail
75+
76+
`pb` can be used to tail live data from Parseable Server. To tail live data, use the `pb tail` command. For example:
6977

7078
```bash
71-
pb query "select * from backend" --from=10m --to=now -i
79+
pb tail backend
7280
```
7381

82+
You can also use the terminal tools like `jq` and `grep` to filter and process the tail output. Some examples:
83+
84+
```bash
85+
pb tail backend | jq '. | select(.method == "PATCH")'
86+
pb tail backend | grep "POST" | jq .
87+
```
88+
89+
To stop tailing, press `Ctrl+C`.
90+
7491
### Stream Management
7592

7693
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:

0 commit comments

Comments
 (0)