Skip to content

PlanetScale CLI commands: audit log

Use the PlanetScale CLI “audit log” command to list all audit logs in an organization from your terminal.

Getting Started

Make sure to first set up your PlanetScale developer environment. Once you've installed the pscale CLI, you can interact with PlanetScale and manage your databases straight from the command line.

The audit log command

Lists all audit logs in an organization. The user running the command must have Organization-level permissions, specifically list_organization_audit_logs.

Usage:

Terminal
pscale audit-log <SUB-COMMAND> <FLAG>

Available sub-commands

Sub-commandDescription
listList all audit logs in an organization

Available flags

FlagDescription
-h, --helpView help for audit-log command
--actionFilter based on action type
--limit intThe number of events to return. Min: 1, Max: 100
--starting-after stringThe ID of the audit log to start after (for pagination)
--org <ORGANIZATION_NAME>The organization for the current user

Global flags

CommandDescription
--api-token <TOKEN>The API token to use for authenticating against the PlanetScale API.
--api-url <URL>The base URL for the PlanetScale API. Default is https://api.planetscale.com/.
--config <CONFIG_FILE>Config file. Default is $HOME/.config/planetscale/pscale.yml.
--debugEnable debug mode.
-f, --format <FORMAT>Show output in a specific format. Possible values: human (default), json, csv.
--no-colorDisable color output.
--service-token <TOKEN>The service token for authenticating.
--service-token-id <TOKEN_ID>The service token ID for authenticating.

Examples

The list sub-command with --org flag

Command:

Terminal
pscale audit-log list --org <ORGANIZATION_NAME>

Output:

Terminal
ID (25) ACTOR (25) ACTION EVENT REMOTE IP LOCATION CREATED AT
------------- ----------- ------------------------ ------------------------ --------------- ---------------- ------------
xxxxxxxxxx Name Open_web_console main branch.open_web_console xxx.xxx.xxx.x Los Angeles, CA 1 day ago

Pagination

Use the ID from the last result and pass it as the --starting-after to retrieve the next page of results.

Terminal
pscale audit-log list --limit 5 --starting-after <ID>

Need help?

Get help from the PlanetScale support team, or join our GitHub discussion board to see how others are using PlanetScale.

Was this page useful?
Last updated on Help us improve this page