Skip to content

Commit

Permalink
UpdatedUpdate Readme to align with pb changes (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
Koustavd18 authored Aug 23, 2024
1 parent bbeaa01 commit a4822fa
Showing 1 changed file with 21 additions and 20 deletions.
41 changes: 21 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@ To install pb, download the binary for your platform, un-tar the binary and plac

## Usage

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:

```bash
pb query -i
```
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.com).

### Profiles

Expand All @@ -38,37 +34,41 @@ 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.

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

or specifying time range in rfc3999

```bash
pb query "select * from backend" --from=2024-01-00T01:40:00.000Z --to=2024-01-00T01:55:00.000Z
pb query run "select * from backend" --from=2024-01-00T01:40:00.000Z --to=2024-01-00T01:55:00.000Z
```

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

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

#### Interactive mode
#### Save Filter

To run queries in interactive TUI mode use the `-i` flag with the query command. For example:
To save a query as a filter use the `--save-as` flag followed by a name for the filter. For example:

```bash
pb query "select * from backend" --from=1m --to=now -i
pb query run "select * from backend" --from=1m --to=now --save-as=FilterName
```

### List Filter

To list all filter for the active user run:

```bash
pb query list
```

### Live Tail
Expand Down Expand Up @@ -119,21 +119,22 @@ pb version
To enable autocomplete for pb, run the following command according to your shell:

For bash:

```bash
pb autocomplete bash > /etc/bash_completion.d/pb
source /etc/bash_completion.d/pb
```

For zsh:

```zsh
pb autocomplete zsh > /usr/local/share/zsh/site-functions/_pb
autoload -U compinit && compinit
```

For powershell

```powershell
pb autocomplete powershell > $env:USERPROFILE\Documents\PowerShell\pb_complete.ps1
. $PROFILE
```


0 comments on commit a4822fa

Please sign in to comment.