tencent cloud

Audit Logs and SQL Analysis
Last updated: 2025-11-28 18:13:27
Audit Logs and SQL Analysis
Last updated: 2025-11-28 18:13:27
TencentDB for MySQL provides the database audit capability, which supports recording database access and SQL statement execution. This feature assists enterprises in risk control and enhances data security. In addition, TencentDB for DBbrain provides the SQL analysis capability to help enterprises perform performance analysis or achieve rapid issue location based on audit logs. The SQL Analysis page aggregates SQL template analysis, allowing users to sort SQL templates globally based on their impact on instance performance metrics over a specified period. These features help users understand statistical information, data distribution, and abnormal values, enabling them to better understand their data and make informed decisions.
This document provides descriptions and operations related to the audit logs from the TencentDB for MySQL side. For more information about SQL analysis, including its introduction, usage, and operations on the TencentDB for DBbrain side, see SQL Analysis (MySQL).

Trial Edition and Official Edition Description

The database audit feature of TencentDB for MySQL and the SQL analysis feature of TencentDB for DBbrain currently offer a 30-day free trial. Trial Edition provides limited capabilities, which can be activated on the Audit Log page and SQL Analysis page in the TencentDB for MySQL console. The following table compares the features between Trial Edition and Official Edition.

Audit Logs

Feature
Trial Edition
Official Edition
Downloading audit logs
Not supported
Supported
Complex query
Not supported
Supported
Time trend comparison
Not supported
Supported
Audit type
Only the full audit supported
Full audit and rule-based audit supported
Query time range
12 hours
Retention duration
SQL query condition
Statement and the name of the database and table
Statement, name of the database and table, SQL template ID, access IP address, user, SQL type, and SQL code
Log detail field
Time, client IP address, database name, user account, SQL type, SQL command details, number of returned rows, number of affected rows, and execution time (µs)
Time, risk level, client IP address, database name, table name, user account, SQL type, SQL command details, error code, thread ID, transaction ID, number of scanned rows, number of returned rows, number of affected rows, execution time (µs), CPU time (µs), lock wait time (µs), I/O wait time (ns), transaction duration (µs), policy name, and audit rule

SQL Analysis

For a comparison between Trial Edition and Official Edition of the SQL analysis capability, see SQL Analysis (MySQL).

Free Trial Description

1. If database audit and SQL analysis are not enabled for your TencentDB for MySQL instances, you can try them for free. The free trial period is within 30 days of activation.
2. If database audit is enabled for your TencentDB for MySQL instances but SQL analysis is not enabled, go to the Audit Log page to view the related log records. At this time, the 30-day free trial of audit logs is not available. However, you can click Try for Free on the SQL Analysis page to obtain a 30-day free trial for SQL analysis.
3. There is no case where SQL analysis is enabled but database audit is not enabled, because when the free trial is enabled on the SQL Analysis page, the free trial of database audit is enabled first.
4. If both database audit and SQL analysis are enabled for your TencentDB for MySQL instances, you can directly go to the Audit Log or SQL Analysis page to view related data. At this time, the 30-day free trials for SQL analysis and audit logs are not available.
5. During the free trial period, you can upgrade from Trial Edition to Official Edition at any time. The remaining time of your free trial can be viewed on both the Audit Log and SQL Analysis pages. Upon expiration of the free trial, if you have not upgraded to Official Edition, all data generated during the use of Trial Edition will be cleared permanently and cannot be recovered.
6. If you disable database audit during the free trial period, you cannot apply for a free trial again. Only the Official Edition database audit can be enabled thereafter.

Billing Description

The Trial Edition audit log and Trial Edition SQL analysis capabilities are free of charge.
Fees are charged for the Official Edition database audit capability. For details, see Database Audit Billing Instructions.
The Official Edition SQL analysis feature is currently in open beta and is available for a free trial. Once the beta phase concludes, an official commercial billing plan will be introduced. For specific pricing details, refer to the official announcement when it is released.

Supported Versions and Architectures

The supported database kernel versions include MySQL 5.6 20180122 and later versions, MySQL 5.7 20190429 and later versions, and MySQL 8.0 20210330 and later versions.
The supported instance architectures include two-node, three-node, and Cluster Edition. Read-only instances are also supported for database audit.
TencentDB for MySQL 5.5 instances, TencentDB for MySQL single-node (cloud disk) instances, the read-only analysis engine, and two-node economical instances do not support database audit.

Enabling the Trial Edition Audit Log Feature

Scenario 1: Enabling the Feature on the Audit Log Page

When you enable the Trial Edition audit log on the Audit Log page, the Trial Edition SQL analysis feature will be enabled simultaneously.
1. Log in to the MySQL console. In the instance list, click Instance ID or Manage in the Operation column to go to the instance details page.
2. Choose Log Center > Audit Log.
3. Click Free Trial.

Note:
Note: This page also provides a button for enabling Official Edition. For details about how to enable Official Edition, see Enabling the Audit Service.
4. Wait for the activation of the Trial Edition audit log.
The Trial Edition Audit Log page is shown in the following figure.


Scenario 2: Enabling the Feature on the SQL Analysis Page

When you enable the Trial Edition audit log on the SQL Analysis page, the Trial Edition audit log will be activated first. To use the Trial Edition SQL analysis, click Try for Free on the SQL Analysis page.
1. Log in to the MySQL console. In the instance list, click Instance ID or Manage in the Operation column to go to the instance details page.
2. Choose Log Center > SQL Analysis.
3. Click Free Trial.

Note:
Note: This page also provides a button for enabling Official Edition. For details about how to enable Official Edition, see Enabling the Audit Service.
4. Wait for the activation of the Trial Edition audit log.
5. Once the feature is enabled, you can view relevant information on the Audit Log page.
6. To use the SQL analysis capability, click Use for Free on the SQL Analysis page.


Upgrading the Audit Log Feature to Official Edition

During the trial period, if you need to upgrade the feature to Official Edition, you can use the following three methods:
Method 1: Click Upgrade to the Official Edition at the top of the Audit Log page to go to the page for enabling the audit service.
Method 2: When the trial countdown reaches 7, 3, or 1 day, a pop-up prompt appears on the Audit Log page. Click Upgrade Now to go to the page for enabling the audit service.
Method 3: On the database audit page, find the instance in the trial period that you want to upgrade to Official Edition, then choose More > Enable Formal Audit Service in the Operation column.
For details about the settings on the audit service page, see Enabling the Audit Service.
Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback