Help Center > > User Guide> Working with RDS for MySQL> Log Management> Enabling the SQL Audit Function

Enabling the SQL Audit Function

Updated at:Nov 20, 2020 GMT+08:00

After you enable the SQL audit function, all SQL operations will be recorded in log files. You can download audit logs to view log details.

By default, the SQL audit function is disabled because enabling this function may affect database performance. This section describes how to enable, modify, or disable the SQL audit function.

  • Only the following versions support SQL audit. If your DB engine version is too early, you can submit a service ticket to apply for a version upgrade.
    • MySQL 5.6.43 or later
    • MySQL 5.7.23 or later
    • MySQL 8.0
  • After you enable the SQL audit function, the system records all SQL operations and uploads logs every half an hour or when the size is accumulated to 100 MB.

Procedure

  1. Log in to the management console.
  2. Click in the upper left corner and select a region and a project.
  3. Click Service List. Under Database, click Relational Database Service. The RDS console is displayed.
  4. On the Instance Management page, click the target DB instance.
  5. In the navigation pane on the left, choose SQL Audits. On the displayed page, click Set SQL Audit above the list. In the displayed dialog box, configure information as required and click OK.

    Enabling or setting SQL audit
    • To retain SQL audit logs, toggle (disabled) to (enabled).
    • Audit logs can be retained from 1 to 732 days and are retained for 7 days by default.
      Figure 1 SQL audit

    Disabling SQL audit

    To disable SQL audit, toggle (enabled) to (disabled).

    • If you select the check box "I acknowledge that after audit log is disabled, all audit logs are deleted.", all audit logs will be deleted.

      Deleted audit logs cannot be recovered. Exercise caution when performing this operation.

    • If you do not select the check box "I acknowledge that after audit log is disabled, all audit logs are deleted.", the audit logs will be retained.

Did you find this page helpful?

Submit successfully!

Thank you for your feedback. Your feedback helps make our documentation better.

Failed to submit the feedback. Please try again later.

Which of the following issues have you encountered?







Please complete at least one feedback item.

Content most length 200 character

Content is empty.

OK Cancel