SQL audit tracks all Data Manipulation Language (DML) and Data Definition Language (DDL) operations on your AnalyticDB for PostgreSQL instance. Use it to inspect SQL statement details and run periodic audits for security compliance and troubleshooting — without affecting instance performance.
Usage notes
Audit logs are retained for 14 days. This period cannot be changed.
Records are collected through network protocol analysis. A small number of records may be lost when processing large query volumes.
View SQL audit records
Prerequisites
Before you begin, ensure that you have:
An AnalyticDB for PostgreSQL instance
Access to the AnalyticDB for PostgreSQL console
Search audit records
Log on to the AnalyticDB for PostgreSQL console.
In the upper-left corner, select the region where the instance resides.
Find the target instance and click its instance ID.
In the left-side navigation pane, click Instance Audit.
Use the following filters to narrow down the audit records:
Filter Description Database Name Filter by the name of the database where the SQL was executed Execution Duration Filter by how long the SQL statement took to run Select Time Range Filter by the time window when the SQL was executed Database User Filter by the database user who ran the statement Source IP Filter by the IP address of the client that sent the request Execution Status Filter by whether the statement succeeded or failed Operation Category Filter by the category of the operation Operation Type Filter by the specific type of database operation Text Search by keywords within the SQL statement text
To save audit records, open the SQL details on the current page and use the copy or export options.
API reference
| Operation | Description |
|---|---|
| DescribeSQLLogCount | Queries the number of audit logs. |