diff --git a/AGENTS.md b/AGENTS.md index 214f5419..cf5e825b 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -240,7 +240,7 @@ pscale sql --org --format json --query "SELECT 1" # Read from replica pscale sql --org --format json --replica --query "SELECT 1" -# PostgreSQL — optional --dbname (default postgres) +# Postgres or Neki — optional --dbname (default postgres) pscale sql --org --format json --query "SELECT 1" # MySQL multi-keyspace — optional --keyspace (default @primary) @@ -251,11 +251,11 @@ pscale sql --org --format json --keyspace - |------|---------| | `--role` | `reader` (default), `writer`, `readwriter`, `admin` — same names as `pscale shell` | | `--replica` | Route reads to replicas | -| `--dbname` | PostgreSQL database name (default `postgres`) | +| `--dbname` | Postgres or Neki database name (default `postgres`) | | `--keyspace` | MySQL keyspace (default `@primary`); may include a shard and tablet type: `mykeyspace/-80`, `mykeyspace/-80@replica` | | `--force` | Allow destructive SQL after explicit user approval | -**`--role` by engine** (same as `pscale shell`): +**`--role` by engine** (same as `pscale shell`; Neki uses the Postgres behavior): | `--role` | MySQL (Vitess) | PostgreSQL | |----------|----------------|------------| @@ -287,6 +287,41 @@ Error: one JSON object on stdout with `status: "error"`, `error`, `issues`, and Destructive SQL without `--force`: `status: "action_required"`, `query_kind: "destructive"`, `issues`, and `next_steps` (includes `--force` retry command). +## Branch logs + +`pscale logs` queries recent logs for a PostgreSQL or Neki branch. It obtains a signed logs URL from the API and prints parsed entries; API credentials are not sent to the signed logs host. + +```bash +# Last hour from the primary server (default) +pscale logs --org --format json + +# Search errors across the last six hours +pscale logs --org --format json --period 6h --level ERROR --query "connection refused" + +# Query an exact ISO 8601 time range +pscale logs --org --format json --from --to + +# Query selected Neki shards and pods +pscale logs --org --format json --shard --server + +# Fetch the next page (100 entries per page by default) +pscale logs --org --format json --page 2 +``` + +| Flag | Purpose | +|------|---------| +| `--query` | Text or LogsQL expression; pipeline stages after `\|` are preserved | +| `--period` | `15m`, `1h` (default), `3h`, `6h`, `12h`, `1d`, `7d`, or `8d` | +| `--from` | Start of a custom ISO 8601 time range; must be used with `--to` and cannot be combined with `--period` | +| `--to` | End of a custom ISO 8601 time range; must be used with `--from` and cannot be combined with `--period` | +| `--level` | Comma-separated or repeatable `DEBUG`, `INFO`, `WARNING`, or `ERROR` filters | +| `--server` | Comma-separated or repeatable server filters; `primary` (default) selects the primary role, other values select pod names | +| `--shard` | Comma-separated or repeatable Neki shard filters | +| `--limit` | Maximum entries per page (default `100`) | +| `--page` | Page number; translated to a LogsQL offset (default `1`) | + +Human output prints one event per line as `