Before you perform performance evaluation, you must obtain the traffic files for your Aurora MySQL instance, AWS MySQL instance, RDS MySQL instance, or PolarDB MySQL instance by following the steps outlined in this topic.
Prerequisites
You have created an Amazon Aurora MySQL instance or an AWS MySQL instance.
You have registered an Alibaba Cloud account and created an RDS MySQL instance or a PolarDB MySQL instance.
Before you perform performance assessment, obtain the audit logs of the Amazon Aurora MySQL instance and collect the qualified audit logs. After collection is complete, export the logs to CloudWatch, and then export the audit logs from CloudWatch to S3 for subsequent parsing and replay.
Open the audit logs in the Amazon Aurora MySQL instance.
Open CloudWatch and import the obtained audit logs.
Export the audit logs from CloudWatch to Amazon S3.
Enable the audit logging feature
(Optional) Create a custom database cluster parameter group.
Before you enable the audit logging feature, you must create a custom database cluster parameter group. If you have already created one, skip this step.
Log in to the Aurora and RDS console.
In the left-side navigation pane, click Parameter Group.
On the Parameter Group > Custom page, click Create Parameter Group in the upper-right corner.
On the Create Parameter Group page, configure the parameters.
ParameterDescriptionParameter Group Name The name of the custom parameter group. This example uses oma-parameter-group. It must start with a letter, be 1 to 255 characters long, and cannot end with a hyphen (-) or contain two consecutive hyphens. Valid characters include A-Z, a-z, 0-9, and hyphens. Description A brief description of the parameter group. Engine Type Select Aurora MySQL. Parameter Group Series The database series to which this parameter group applies. Select the parameter group series corresponding to your database version. A database parameter group can only belong to one parameter group series. For example, if you are using Aurora MySQL Database V8.0, select aurora-mysql8.0. Type The type of the database parameter group. Select DB Cluster Parameter Group. Click Create.
Associate the database cluster parameter group with the Amazon Aurora MySQL instance.
Return to the homepage of the Aurora and RDS console, and click Database in the left-side navigation pane.
On the Database page, select the target database cluster and click Modify.
In the Other Configurations section of the Modify Database Cluster page, select the custom database cluster parameter group oma-parameter-group from the Database Options > Database Cluster Parameter Group drop-down list.
Click Continue.
In the Scheduled Modifications section of the Modify Database Cluster page, set When to Apply Modifications to Apply Immediately.
Click Modify Cluster.
Confirm that the database cluster parameter group has been successfully associated with the Amazon Aurora MySQL instance.
Return to the Database page, select the Aurora MySQL instance, and click Actions > Restart in the upper-right corner.
Notice
After you modify a database cluster parameter group associated with a database instance, the changes take effect only after you restart the instance. However, a restart applies the changes to all database instances in the database cluster. Please confirm the risks before proceeding. For more information, see Parameter groups.
On the Restart Database Instance page, click OK.
After the restart is successful, click the database identifier of the Aurora MySQL instance on the Database page.
On the details page of the Aurora MySQL instance, click the Configuration tab.
On the Configuration tab, wait for the status of Database Cluster Parameter Group to display as Synchronized, indicating that the association is successful.
Enable advanced auditing.
Return to the homepage of the Aurora and RDS console, and click Parameter Group in the left navigation bar.
On the Parameter Group > Custom page, select the created parameter group, and click Actions > Edit in the upper-right corner of the page.
On the Modifiable Parameters page, search for
server_audit_loggingand set Value to 1.Click Save Changes.
Configure audit logs.
Return to the homepage of the Aurora and RDS console, and click Parameter Group in the left navigation bar.
On the Parameter Group > Custom page, select the created parameter group, and click Actions > Edit in the upper-right corner of the page.
On the Modifiable Parameters page, search for
server_audit_eventsand set Value to CONNECT,QUERY,QUERY_DCL,QUERY_DDL,QUERY_DML,TABLE.This parameter is used to configure audit options for different database events. Separate multiple events with commas (,), and do not add spaces.
Click Save Changes.
Confirm the audit logs of the Amazon Aurora MySQL instance.
Return to the homepage of the Aurora and RDS console, and click Database in the left navigation pane.
On the Database page, click the database identifier of the Aurora MySQL instance.
On the details page of the Aurora MySQL instance, click the Logs and Events tab.
On the Logs and Events tab, in the Logs section, select the audit log
audit/audit.logyou want to view and click View in the upper-right corner.
Export audit logs to CloudWatch
You can publish the logs of an Amazon Aurora MySQL instance in a configured database cluster to Amazon CloudWatch Logs.
On the homepage of the Aurora and RDS console, click Database in the left-side navigation pane.
On the Database page, select the target database cluster and click Modify.
In the Other Monitoring Configurations > Log Export section, select the log types to publish to Amazon CloudWatch Logs.
Notice
Audit logs are required. Select other log types as needed.
Click Continue.
In the Scheduled Modification section of the Modify Database Cluster page, set When to Apply Modifications to Apply Immediately.
Click Modify Cluster.
Export audit logs from CloudWatch to S3
Note
Using the S3 service incurs fees. Proceed with caution.
You can choose for the audit logs and the target Amazon S3 bucket to be in the same account or different accounts. This topic uses the scenario where they are in the same account as an example. For export methods using different accounts, refer to the AWS official documentation.
Log in to the CloudWatch console using an authorized account.
In the left-side navigation pane, click Logs > Log Groups.
On the Log Groups page, select the target log group, and then click Actions > Export Data to Amazon S3 in the upper-right corner of the page.
In the Define Data Export section of the Export Data to Amazon S3 page, select the time range for which you want to export data.
In the Select an S3 Bucket section, configure the parameters.
ParameterDescriptionSelect Account Includes This Account and Another Account. The example in this topic is This Account. S3 Bucket Name From the drop-down list, select the name of the created S3 bucket. S3 Bucket Prefix (Optional) Customize the prefix for the S3 bucket. Click Export.
Click View Export Task in the upper-right corner of the page.
On the Export Tasks page, select the completed export task and click View in Amazon S3 in the upper-right corner to view all exported logs.
Preparation
Before creating a task to export audit logs to S3, you need to complete the preparation work. For details, see Export log data to Amazon S3 using the console.
Create an export task
View an export task
After an export task is successfully created, you are automatically redirected to the log group details page, where you can view detailed information about the export task.
Enable the audit logging feature
(Optional) Create a custom option group.
Before enabling the audit logging feature, you must create a custom option group. If you have already created one, skip this step.
Log in to the Aurora and RDS console.
In the left navigation pane, click Option Group.
On the Option Group page, click Create Group in the upper-right corner.
On the Create Option Group page, configure the parameters.
ParameterDescriptionName The name of the custom option group. Description A brief description of the option group. Engine Select MySQL. Major Engine Version Select the appropriate MySQL version. Click Create.
Add options to the option group.
On the Option Group page, click the name of the target option group.
In the Option section of the details page, click Add Option in the upper-right corner.
On the Add Option page, configure the parameters.
ParameterDescriptionOption Name Select MARIADB_AUDIT_PLUGIN. Option Setting For the SERVER_AUDIT_EVENTS option, set the value based on your actual situation. For example, CONNECT,QUERY,QUERY_DDL,QUERY_DML,QUERY_DCL.Note
You cannot set both values
QUERY_DMLandQUERY_DML_NO_SELECT. Choose one based on your actual situation.Separate multiple values with commas (,). Do not include spaces.
Apply Now Choose whether to apply immediately based on your actual situation. Click Add Option in the lower-right corner of the page.
Export audit logs to CloudWatch
You can publish the logs of an Amazon Aurora MySQL instance in a configured database cluster to Amazon CloudWatch Logs.
On the homepage of the Amazon RDS console, click Database in the left navigation pane.
On the Database page, select the target database cluster and click Modify.
In the Other Monitoring Configurations > Log Export section, select the log type to publish to Amazon CloudWatch Logs.
Notice
Audit Log is required here. Select other log types as needed.
In the Other Configurations > Database Options section, select the option group created earlier from the Option Group drop-down list.
Click Continue.
In the Scheduled Modification section of the Modify Database Instance page, set When to Apply Modifications to Apply Immediately.
Click Modify Database Instance.
Export audit logs from CloudWatch to S3
Note
Using the S3 service incurs fees. Proceed with caution.
You can choose for the audit logs and the target Amazon S3 bucket to be in the same account or different accounts. This topic uses the operation within the same account as an example. For export methods between different accounts, refer to the AWS official documentation.
Log in to the CloudWatch console using an authorized account, and select the target region in the upper-right corner of the page.
In the left navigation pane, click Logs > Log Groups.
On the Log Groups page, select the target log group, and click Actions > Export Data to Amazon S3 in the upper-right corner of the page.
In the Define Data Export section of the Export Data to Amazon S3 page, select the time range for which you want to export data.
In the Select S3 Bucket section, configure the parameters.
ParameterDescriptionSelect Account Includes This Account and Another Account. The example in this topic is This Account. S3 Bucket Name From the drop-down list, select the name of the created S3 bucket. S3 Bucket Prefix (Optional) Customize the prefix for the S3 bucket. Click Export.
Click View Export Task in the upper-right corner of the page.
On the Export Task page, select a completed export task and click View in Amazon S3 in the upper-right corner to view all exported logs.
Preparation
Before creating a task to export audit logs to S3, you need to complete the preparation work. For details, see Export log data to Amazon S3 using the console.
Create an export task
View an export task
After successfully creating an export task, you will automatically be redirected to the log group details page, where you can view the details of the export task.
The Cloud Log Service supports quickly enabling the log collection feature. After enabling the audit log collection feature, the SQL insight (SQL audit) feature is automatically enabled for eligible RDS instances.
The Cloud Log Service supports collecting logs from cloud services such as storage, network, and databases. After collection is complete, the logs are automatically stored in the corresponding Logstore or Metricstore.
First configuration
Notice
This operation only needs to be performed once.
Log in to the Cloud Log Service console.
On the Log Application > Audit and Security tab, click Cloud Log Service.

Complete the authorization as prompted on the page.
After authorization is completed, the Cloud Log Service will use the service-associated role
AliyunServiceRoleForSLSAuditto collect logs from cloud services.
Enable log collection
Enable the SQL audit log collection feature.
Go to the Cloud Product Access > Global Configuration page of the Cloud Log Service.
On the Global Configuration page, click Modify in the upper-right corner.

In the drop-down list of Region where the Centralized Log Storage Project is Located, select the target region for centralized log storage.

In the cloud product list, click the SQL Audit Logs switch next to RDS.

To obtain audit logs for a PolarDB MySQL instance, click the Audit Logs switch next to PolarDB.

Review the content in the Prompt dialog box, and then click Go to Collection Policy.
In the Collection Policy Configuration dialog box, configure the collection policy.
The Log Service supports configuring collection policies through Default Collection Policy or Advanced Edit Mode. For more information, see Collection Policy.
Notice
If you configure the Default Collection Policy, all instances in all regions will be collected by default, which may result in unexpected costs. It is recommended that you use Advanced Edit Mode to configure the instances that require log collection.

In the Policies to Add section, select the attribute as Instance ID, the operator as Exact Match, and enter the RDS MySQL instance ID or PolarDB MySQL instance ID for which logs need to be collected in the text box on the right.
This attribute configuration is only an example; you can modify it according to your actual situation.
Click Add Policy in the lower-right corner of the dialog box.
After confirming the configuration is correct, click OK.
Return to the Global Configuration page, click OK, and wait for the configuration modification to complete.
Obtain traffic files for an instance
You can obtain the traffic files for a target instance by saving the traffic files from the Simple Logging Service (SLS) to Object Storage Service (OSS) or by downloading the SQL audit logs locally. The corresponding methods are the Data Collected From options on the Configure Data Collection page when creating a performance assessment task. These options include Import to Object Storage Service (OSS) and Upload File.
If you save the traffic files from SLS to OSS, select Import to Object Storage Service (OSS) to import the traffic files for assessment.
If you download the SQL audit logs locally, select Upload File to import the traffic files for assessment.
Save traffic files from SLS to OSS
Note
Migration assessment only supports traffic files delivered in real time; it does not support files retrospectively delivered from SLS. For example, if you enable OSS delivery 2 hours after enabling SLS log monitoring, migration assessment will not receive traffic files from the previous 2 hours.
Return to the Log Service console.
In the Project List area, click the name of the target project to go to the Log Library page.
For details on creating a project, see Manage projects.
In the left navigation pane, expand Data Processing > Export under the target Logstore, hover over OSS (Object Storage), and click the displayed + icon.
In the Create Delivery Task dialog box, select OSS Export and click OK.
In the OSS Delivery Feature dialog box, configure the parameters to export logs to OSS. For details, see Create an OSS delivery task (new version).
Note
When configuring the OSS Delivery Feature dialog box, follow these rules:
- File Delivery Directory: This field is required.
- Partition Format: %Y/%m/%d/%H/%M.
- Storage Format: Only the JSON format is supported.
- Compress: Only Compress (Snappy) is supported.
After configuration, click OK.
Download SQL audit logs
Return to the Log Service console.
In the Project List area, click the name of the target project to go to the Log Library page.
For more information about how to create a project, see Manage projects.

In the left-side navigation pane, click the name of the target logstore to open its details page.
For more information about how to create a logstore, see Manage logstores.
On the Raw Logs tab, click the download icon and select Download Logs.

You can also select a time period to view logs and statistics.

In the Log Download dialog box, select Offline Download and configure the parameters as prompted.
Note
Currently, only the
gzipcompression format is supported.
After configuration, click OK.
After the task succeeds, in the Download Task dialog box that appears, click Download.

Create a database instance
Log in to the Google Cloud Console.
Click Select a project in the upper-left corner of the page, and then click the name of the target project in the Select a resource dialog box.
On the Cloud SQL Console homepage, click CREATE INSTANCE.
On the Create an instance page, click Choose MySQL in the Choose your database engine section.
On the Create a MySQL instance page, select the Cloud SQL version, configure the database version, instance ID, root user password, and other instance information as needed. Also, select a region and enable public IP. For configuration details, see Create instances.
Add database flags to export audit logs.
In the Customize your instance section, click SHOW CONFIGURATION OPTIONS.
Expand the Flags option and click ADD A DATABASE FLAG.
Select the general_log flag from the drop-down list, set its value to On, and click DONE.
Click ADD A DATABASE FLAG, select the log_output flag from the drop-down list, set its value to FILE, and click DONE.
Click CREATE INSTANCE.
After the instance is created, add the source IP or IP range to the database's authorized networks.
Return to the Cloud SQL Console homepage, click the name of the target instance, and go to the instance details page.
Click Connections in the left navigation pane.
On the Connections page, click the NETWORKING tab.
In the Authorized networks section, click ADD A NETWORK.
In the New network dialog box, enter the network name and source IP/IP range, then click DONE.
Click SAVE at the bottom of the Connections page.
Create a database and a user in the Cloud SQL instance (optional). For more information, see Create and manage databases and Create a user.
Create a bucket and obtain the AK/SK
Log in to the Cloud Storage console of the corresponding project.
Click + CREATE BUCKET on the OVERVIEW tab.
On the Create a bucket page, configure the information.
In the Get Started section, enter a globally unique permanent name that complies with naming guidelines. Decide whether to enable hierarchical namespaces and add tags based on your actual situation, then click CONTINUE.
In the Choose where to store your data > Location type section, select Region, choose the corresponding region from the drop-down list, then click CONTINUE.
In the Choose a storage class for your data > Set a default class section, select Standard, then click CONTINUE.
In the Choose how to control access to objects > Access control section, select Uniform, then click CONTINUE.
Click CREATE at the bottom of the page.
After creation is complete, obtain the AK/SK for Cloud Storage. For more information, see Create an access key.
Create a log router
Go to the Logs Explorer console.
Select a log source.
On the Logs Explorer page, click All resources.
In the drop-down list, sequentially select Cloud SQL Database, the target database ID, and the corresponding region.
Click Apply.
Select the corresponding log type file.
On the Logs Explorer page, click All log names.
In the Select log names drop-down list, select the log type file for Cloud SQL.
Click Apply.
Copy the command line displayed on the Logs Explorer page for log filtering by the log router later.
Create a log router to route logs to Cloud Storage.
Go to the Log router console.
On the Log Router page, click Create sink.
On the Create logs routing sink page, configure the parameters.
In the Sink details section, enter the sink name and description. Click Next.
In the Sink destination section, select Cloud Storage bucket as the sink service, then click Browse to select the created bucket. Click Next.
In the Choose logs to include in sink section, paste the command line copied from the Logs Explorer page. Click Next.
Click Create sink at the bottom of the page.
