SQL Explorer and Audit
DAS provides SQL Explorer and Audit for ApsaraDB RDS for PostgreSQL. By analyzing all requests, this feature provides deep insights into SQL statements and helps you troubleshoot performance issues. This topic describes how to use SQL Explorer and Audit.
Supported databases and regions
The SQL Explorer and Audit feature is available only after you enable DAS Enterprise Edition. The supported databases and regions vary by edition. For a list of the databases and regions supported by each edition, see Supported databases and regions for each edition.
Billing
-
You can use the SQL Explorer and Audit feature only after you enable DAS Enterprise Edition. For information about the billing of different editions, see Product billing.
-
After you enable SQL Explorer and Audit, in addition to the base fee of DAS Enterprise Edition, a separate storage fee continues to be incurred based on the volume of SQL logs stored. To stop this storage billing, you must manually disable SQL Explorer and Audit in the DAS console or in the console of the database that uses SQL Explorer and Audit. Performing only the following operations does not stop this storage billing:
-
Disabling DAS Agent
-
Canceling the auto-renewal of DAS Enterprise Edition
-
Enable SQL Explorer and Audit
If you have already enabled DAS Enterprise Edition for a database instance, the SQL Explorer and Audit feature is enabled automatically. For more information, see Enable DAS Enterprise Edition.
Log on to the DAS console.
In the navigation pane on the left, click .
Find the target instance and click the instance ID to open the instance details page.
-
In the left-side navigation pane, click Request Analysis > SQL Explorer and Audit.
-
On the SQL Explorer and Audit page, enable the SQL Explorer and Audit feature.
If DAS Enterprise Edition is not enabled for your Alibaba Cloud account, follow the on-screen instructions to enable it. For more information, see Enable DAS Enterprise Edition.
Use SQL Explorer and Audit
Log on to the DAS console.
In the navigation pane on the left, click .
Find the target instance and click the instance ID to open the instance details page.
-
In the left-side navigation pane, choose . You can use the following features:
-
Search: Query and export SQL statements and related information, such as the database, status, and execution duration. For more information, see Audit.
-
️SQL Explorer: Diagnose SQL health, troubleshoot performance issues, and analyze business traffic. For more information, see SQL Explorer.
-
Change the data retention period
If you reduce the data retention period, DAS immediately deletes all sql audit logs older than the new period. We recommend that you export and save the sql audit logs to a local device before you reduce the data retention period.
Log on to the DAS console.
In the navigation pane on the left, click .
Find the target instance and click the instance ID to open the instance details page.
-
In the left-side navigation pane, click Request Analysis > SQL Explorer and Audit.
-
On the SQL Explorer and Audit page, click Service Settings.
-
Change the retention period and click Submit.
If you have enabled DAS Enterprise Edition V3, you can change the data retention period for different sub-features.
Note-
You can also set the Data Storage Duration for SQL Explorer and Audit on the DAS Professional Edition Management page. For more information, see Manage DAS Enterprise Edition.
-
The storage space for SQL Explorer and Audit data is provided by DAS and does not use your database instance's storage space.
-
Disable SQL Explorer and Audit
Disabling the SQL Explorer and Audit feature does not affect your services, but it deletes all sql audit logs. We recommend that you export and save the sql audit logs to a local device before you disable this feature. If you enable the feature again, sql audit logs will be recorded from the time of re-enablement.
Log on to the DAS console.
In the navigation pane on the left, click .
Find the target instance and click the instance ID to open the instance details page.
-
In the left-side navigation pane, click Request Analysis > SQL Explorer and Audit.
-
On the SQL Explorer and Audit page, click Search.
-
In the log list area of the Search tab, click Export.
-
In the dialog box that appears, select the fields to export and the time range.
-
Download the exported file and save it to a secure location.
The data download process varies by DAS Enterprise Edition.
-
On the Search tab, download the exported file from the View Exported Logs.
-
On the Task list tab, download the exported file.
-
-
Click Service Settings to disable SQL Explorer and Audit.
If you have enabled DAS Enterprise Edition V3, deselect all features for SQL Explorer and Audit, and then click Submit.
NoteApproximately one hour after you disable the SQL Explorer and Audit feature, the system releases the storage space used for its data.