Enabling the SQL Audit Function
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.
- Log in to the management console.
- Click in the upper left corner and select a region and a project.
- Click Service List. Under Database, click RDS. The RDS console is displayed.
- On the Instance Management page, click the target DB instance.
- 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, click .
- 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, click .
- If you select the acknowledgment checkbox, all audit logs will be deleted after SQL audit is disabled.
Deleted audit logs cannot be recovered. Exercise caution when performing this operation.
- If you do not select the acknowledgment checkbox, the audit logs generated before SQL audit is disabled are retained and incur additional costs.