All Products
Search
Document Center

ApsaraDB RDS:Use the SQL Explorer and Audit feature

Last Updated:Dec 22, 2023

Database Autonomy Service (DAS) provides the SQL Explorer and Audit feature. The SQL Explorer and Audit feature is developed based on the full request analysis and security audit capabilities and is integrated with the search feature and the SQL Explorer feature. You can query information about SQL statements and use the information to troubleshoot various performance issues.

Prerequisites

  • DAS Professional Edition is purchased by using your Alibaba Cloud account. For more information about how to purchase DAS Professional Edition, see Purchase DAS Professional Edition.

  • Your RDS instance runs RDS High-availability Edition.

  • The RDS instance resides in one of the following regions: China (Hangzhou), China (Shanghai), China (Beijing), China (Shenzhen), China (Zhangjiakou), Singapore, Malaysia (Kuala Lumpur), and Indonesia (Jakarta).

  • If you use the credentials of a RAM user to use the search feature, make sure that the AliyunRDSReadOnlyWithSQLLogArchiveAccess policy is attached to the RAM user. For more information about how to grant permissions to a RAM user, see Use RAM to manage ApsaraDB RDS permissions.

    Note

    You can also create a custom policy to grant the RAM user the permissions to use the search feature, including the log export feature. For more information, see Use custom policies to grant a RAM user the permissions to use the search and export features in the SQL Explorer and Audit module.

Billing rules

For more information, see Billing rules of the previous version.

Note

After the SQL Explorer and Audit feature is enabled, ApsaraDB RDS stops billing for the SQL Audit feature. The SQL Explorer and Audit feature is billed based on the pricing of DAS Professional Edition. For more information, see Use the SQL Audit feature.

Feature description

  • Search: queries and exports the information about the SQL statements that are executed. The information includes the execution history of the SQL statements and the database, status, and execution duration of each SQL statement.

  • SQL Explorer: diagnoses the SQL statements, troubleshoots performance issues, and analyzes business traffic.

Usage notes

If PgBouncer is enabled for your RDS instance, SQL statements that are executed by using PgBouncer are not recorded by the SQL Explorer and Audit feature.

Enable the SQL Explorer and Audit feature

  1. Go to the Instances page. In the top navigation bar, select the region in which the RDS instance resides. Then, find the RDS instance and click the ID of the instance.
  2. In the left-side navigation pane of the page that appears, choose Autonomy Services > SQL Explorer and Audit.

  3. If the SQL Explorer and Audit feature is not enabled, click Enable on the page that appears. In the dialog box that appears, click Enable Professional Edition.

    Note

    If the Search and SQL Explorer tabs are displayed on the page that appears, the SQL Explorer and Audit feature is enabled.

Query information on the Search tab

  1. Go to the Instances page. In the top navigation bar, select the region in which the RDS instance resides. Then, find the RDS instance and click the ID of the instance.
  2. In the left-side navigation pane of the page that appears, choose Autonomy Services > SQL Explorer and Audit.

  3. On the page that appears, click the Search tab. Then, specify the search conditions to query the relevant information. For more information about the search feature, see Search.

    To export logs, click Export and configure the Exported Fields parameter in the Export SQL Records dialog box. You can configure the Export Time Range parameter to export logs that are generated both within and beyond a time range of 24 hours.

Query information on the SQL Explorer tab

  1. Go to the Instances page. In the top navigation bar, select the region in which the RDS instance resides. Then, find the RDS instance and click the ID of the instance.
  2. In the left-side navigation pane of the page that appears, choose Autonomy Services > SQL Explorer and Audit.

  3. On the page that appears, click the SQL Explorer tab to view the relevant information. For more information about the SQL Explorer feature, see Use the SQL Explorer feature.

FAQ

Why am I unable to query the SQL statements that fail to be executed in an RDS instance?

The SQL statements that fail to be executed in the RDS instance are recorded in the error log instead of the audit logs of the instance. For more information about how to query the error log of the RDS instance, see View the logs of an ApsaraDB RDS for PostgreSQL instance.