This topic describes how to collect RDS SQL audit logs in the Simple Log Service console.
Prerequisites
An ApsaraDB RDS instance is created. If an ApsaraDB RDS for MySQL instance is created, the SQL Explorer feature of a paid edition is enabled for the instance. For more information, see Create an ApsaraDB RDS for MySQL instance and Use the SQL Explorer feature on an ApsaraDB RDS for MySQL instance.
A Simple Log Service project and Logstore are created in the region where the ApsaraDB RDS instance resides. For more information, see Create a project and a Logstore.
Procedure
Log on to the Simple Log Service console.
In the Import Data section, click RDS SQL Audit - Cloud Products.
In the Specify Logstore step, select the project and Logstore that you created, and click Next.
In the Specify Data Source step, complete RAM authorization, enable the data shipping feature, and then click Next.
ImportantIf you have not authorized Simple Log Service to ship logs, click Authorize next to RAM, and complete the authorization as prompted. After the authorization is completed, the
AliyunLogArchiveRole
is created. Then, Simple Log Service assumes this RAM role to collect logs.The destination ApsaraDB RDS instance may not appear on the prompted page or the data shipping feature may fail to be enabled. This issue occurs when your ApsaraDB RDS instance does not meet the required conditions. For more information about how to check whether your ApsaraDB RDS instance meets the required conditions, see the Prerequisites section.
In the Query and Analysis Configurations step, click Next.
By default, the indexing feature is enabled for the Logstore where RDS SQL audit logs are stored, and indexes are configured for the audit logs. For information about how to modify indexes, see Create indexes.
What to do next
If you want to monitor and manage SQL statements that are executed on an ApsaraDB RDS for MySQL instance, you can use the SQL Explorer and Audit feature to record and track the execution of SQL statements. For information about how to enable and disable the SQL Explorer and Audit feature in the ApsaraDB RDS console, see Use the SQL Explorer and Audit feature.
Simple Log Service provides the CloudLens for RDS application. You can use CloudLens for RDS to check the collection status of SQL audit logs, error logs, and slow query logs for ApsaraDB RDS instances in real time and manage collection configurations in a centralized manner. You can also audit and analyze collected logs and configure alert rules for the logs. For more information, see Usage notes.
After RDS SQL audit logs are collected to Simple Log Service, you can query, analyze, download, ship, and transform the logs. You can also configure alert rules for the logs. For more information, see Common operations on logs of Alibaba Cloud services.