All Products
Search
Document Center

Database Autonomy Service:SQL Explorer and Audit

Last Updated:Dec 17, 2024

Database Autonomy Service (DAS) provides the SQL Explorer and Audit feature. This allows you to use value-added services on your databases, such as security audit and performance diagnostics.

Prerequisites

A PolarDB for PostgreSQL cluster is created.

Important

From February 24, 2023, DAS supports the SQL Explorer and Audit feature for PolarDB for PostgreSQL clusters.

Features

  • SQL audit logging

    You can record all the operations that are performed on your databases. You can use SQL audit logs to perform operations such as fault analysis, behavior analysis, and security audit.

  • Enhanced search

    You can query data from various dimensions, such as database, user, client IP address, thread ID, execution duration, and number of scanned rows. You can export and download query results.

  • SQL analysis

    A visualized and interactive solution is provided for you to analyze the audit logs of SQL statements that are executed within the specified period of time. This allows you to find the SQL statements that are not executed as expected and troubleshoot performance issues.

Enable SQL Explorer and Audit

  1. Log on to the DAS console.

  2. In the left-side navigation pane, click Instance Monitoring.

  3. On the page that appears, find the database instance that you want to manage and click the instance ID. The instance details page appears.

  4. In the left-side navigation pane, choose Request Analysis > SQL Explorer and Audit.

  5. On the SQL Explorer and Audit page, click Enable Enterprise EditionV3. In the Configure DAS Enterprise Edition step, select the features that you want to use, specify the storage duration of SQL logs, and then click Submit.

Modify the storage duration of SQL audit logs

  1. Log on to the DAS console.

  2. In the left-side navigation pane, click Instance Monitoring.

  3. On the page that appears, find the database instance that you want to manage and click the instance ID. The instance details page appears.

  4. In the left-side navigation pane, choose Request Analysis > SQL Explorer and Audit.

  5. Click Service Settings. In the panel that appears, modify the storage duration and click Submit.

Export SQL audit logs

  1. Log on to the DAS console.

  2. In the left-side navigation pane, click Instance Monitoring.

  3. On the page that appears, find the database instance that you want to manage and click the instance ID. The instance details page appears.

  4. In the left-side navigation pane, choose Request Analysis > SQL Explorer and Audit.

  5. On the SQL Explorer and Audit page, click the Audit tab.

  6. In the Logs section of the Audit tab, click Export.导出

  7. In the dialog box that appears, configure the Exported Fields and Export Time Range parameters, and click OK.

  8. In the dialog box that appears, configure the Task name and CSV Separator parameters and click Confirm to submit a task. Then, the system creates an export task. You can click Task list in the upper-right corner of the SQL Explorer and Audit page to view the task progress and download the exported file.

Disable SQL Explorer and Audit

Warning

After you disable the SQL Explorer and Audit feature, your business is not affected. However, SQL audit logs are cleared. Before you disable the SQL Explorer and Audit feature, we recommend that you export the SQL audit logs as a file and download the file to your computer. If you enable the SQL Explorer and Audit feature again, SQL audit logs are generated from the point in time when the SQL Explorer and Audit feature is enabled.

  1. Log on to the DAS console.

  2. In the left-side navigation pane, click Instance Monitoring.

  3. On the page that appears, find the database instance that you want to manage and click the instance ID. The instance details page appears.

  4. In the left-side navigation pane, choose Request Analysis > SQL Explorer and Audit.

  5. Export SQL audit logs. For more information, see the Export SQL audit logs section of this topic.

  6. Click Service Settings. In the Service Settings panel, clear all features of SQL Explorer and Audit and click Submit.

    Note

    The storage space that is occupied by the data generated by the SQL Explorer and Audit feature is released one hour after the SQL Explorer and Audit feature is disabled.

View the size and consumption details of audit logs

  1. Log on to the Alibaba Cloud Management Console.

  2. In the upper-right corner of the page, select Expenses.

  3. In the left-side navigation pane of the Expenses and Costs page, choose Bills > Bill Details.

  4. On the Bill Details page, click the Billing Details tab. In the search bar, select Instance ID from the drop-down list and enter the ID of the cluster for which you want to query the details.

    image

  5. View the billing details in the data entries in which the value in the Billing Item column is sql_explorer.