AnalyticDB for PostgreSQL allows you to use the SQL audit feature to view SQL details and audit SQL queries on a regular basis. The SQL audit feature does not affect instance performance.
SQL audit records all DML and DDL operations. The system captures such operations by analyzing data transmitted over network protocols. A few records may be lost when a large number of SQL queries are sent to database instances.
SQL audit logs are retained for 30 days.
For more information, see AnalyticDB for PostgreSQL pricing.
- Log on to the AnalyticDB for PostgreSQL console.
- In the upper-left corner of the console, select the region where the instance resides.
- Find the instance that you want to manage and click its ID.
- In the left-side navigation pane, click SQL Audit.
- On the SQL Audit tab, search SQL information by Database Name, Execution Duration, Select Time Range, Database User, Source IP, Execution Status, Operation Category, Operation Type, and Text.
Note You can copy and export SQL information on the current page from SQL details.
|DescribeSlowLogRecords||Queries the slow query details of a database in an instance within a specified period of time.|
|DescribeSlowSQLLogs||Queries the slow query logs of an instance within a specified period of time.|
|DescribeSQLCollectorPolicy||Queries whether the SQL collection feature is enabled for an instance.|
|DescribeSQLLogByQueryId||Queries slow query logs by query ID.|
|DescribeSQLLogFiles||Queries a list of SQL audit log files of an instance.|
|DescribeSQLLogRecords||Queries the details of SQL audit logs of an instance within a specified period of time.|
|ModifySQLCollectorPolicy||Enables or disables the SQL collection feature for an instance.|