Skip to main content

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:

Available sub-commands

The list sub-command flags

The auth-attempts download sub-command

Generates a report of authentication attempts against your Postgres databases and downloads it as a ZIP archive. Each authentication attempt includes information such as the source IP address, credential, targeted database and branch, outcome, and failure details. Available to Organization Administrators only. Service tokens cannot generate these reports. Usage:
The command generates the report, waits for it to be ready, and writes the archive to disk. The archive contains two files: the data (auth-attempts.csv, .jsonl, or .parquet) and a manifest.json recording the exact window and filters used.

Time window flags

Specify either --since or --start-at. Named values and timestamps without a zone use your local timezone; requests are sent in UTC. The window is inclusive of start-at and exclusive of end-at.

Filter flags

Filters combine with AND. Repeat a flag to match any of several values.

Output flags

Global flags

Examples

The list sub-command with --org flag

Command:
Output:

Pagination

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

Download authentication attempts

Export the last 24 hours:
Output:
Filter by a source IP address or range:
Filter by authentication username:
Export a fixed window as Parquet:
Write the archive to stdout instead of directly to a file:
See Authentication attempts for what the report contains and how to work with it.

Need help?

Get help from the PlanetScale Support team, or join our Discord community to see how others are using PlanetScale.