All Products
Search
Document Center

AnalyticDB for MySQL:Configure SQL audit

Last Updated:Dec 26, 2023

AnalyticDB for MySQL provides the SQL audit feature to log real-time DML and DDL operations that are executed in databases.

Limits

The following operations are not recorded in SQL audit logs:

  • INSERT INTO VALUES

  • REPLACE INTO VALUES

  • UPSERT INTO VALUES

Enable or disable SQL audit

  1. Log on to the AnalyticDB for MySQL console.
  2. In the upper-left corner of the page, select a region.
  3. In the left-side navigation pane, click Clusters.
  4. On the Data Warehouse Edition (V3.0) or Data Lakehouse Edition (V3.0) tab, find the cluster and click the cluster ID.

  5. Go to the SQL Audit page.

    • For a Data Warehouse Edition (V3.0) cluster, click Data Security in the left-side navigation pane and then click the SQL Audit tab.

    • For a Data Lakehouse Edition (V3.0) cluster, choose Clusters > SQL Audit in the left-side navigation pane.

  6. Click SQL Audit Configuration.

  7. In the dialog box that appears, select Yes and click OK.

    1

  8. If you no longer need the SQL audit feature, repeat Steps 1 to 6. In the SQL Audit Configuration dialog box, select No.

    Important

    After SQL audit is disabled, SQL audit logs are cleared. You must query and export SQL audit logs before you disable SQL audit. For more information, see the "Query and export SQL audit logs" section of this topic. When you enable SQL audit again, audit logs generated from the last time when SQL audit was enabled are available for queries.

Query and export SQL audit logs

On the SQL Audit tab, query SQL audit logs within a specific period of time based on Operation Type or Execution Status.

Note
  • You can query SQL audit logs that were generated only within the last 30 days.

  • The time range for a single query must be within 24 hours. If you want to save SQL audit logs to your computer, click Export Current Page.

Related operations

Edition

Operation

Data Warehouse Edition (V3.0)

DescribeAuditLogConfig

ModifyAuditLogConfig

DescribeAuditLogRecords