You can view error logs and slow query logs for an instance on the Logs page in the ApsaraDB RDS console to troubleshoot issues.
This topic describes how to view error logs and slow query logs. For information about binary logs, see automatic backup and download backup.
For log management on other database engines, see these topics:
Usage notes
-
For an instance in the China (Zhangjiakou) region, error logs are retained for 9 days, while data on the Slow Log Details and Slow Log Summary tabs is retained for 7 days.
-
The error logs do not contain deadlock logs. To view deadlock logs, go to the instance details page. In the left-side navigation pane, choose Autonomy Services > Diagnostics and click the Lock Analysis tab.
-
Slow query log completeness: In the following extreme scenarios, slow query logs may be incomplete or partially lost:
-
The instance is under high load and has a performance bottleneck.
-
The instance receives a high volume of SQL requests.
-
The control service component that collects slow query logs malfunctions.
-
View logs
Log on to the ApsaraDB RDS console and go to the Instances page. In the top navigation bar, select the region in which the RDS instance resides. Then, find the RDS instance and click the instance ID.
-
In the left-side navigation pane, click Logs.
-
On the Logs page, click the Error Logs, Slow Log Details, or Slow Log Summary tab. Select a time range. The details for the selected period appear automatically.
-
Records database runtime errors. By default, logs are retained for 30 days, but this period can vary by region. For example, logs for instances in the China (Zhangjiakou) region are retained for 9 days.
-
To view complete deadlock logs in the error logs, you must enable the following parameters on the RDS instance management page:
-
Enable the
innodb_deadlock_detectparameter. -
Enable the
innodb_print_all_deadlocksparameter, and set thelog_error_verbosityparameter to 3.
-
|
Item |
Description |
|
Binlog Subscription |
Subscribe to binary logs by using Data Transmission Service (DTS). |
|
Error logs |
|
|
Slow Log Details |
Records individual SQL statements that ran for more than 1 second within the last 7 days. You can change this threshold by modifying the long_query_time parameter in parameter settings. Similar statements are deduplicated. Note
The console updates once per minute. |
|
Slow Log Summary |
Contains a statistical summary and analysis report of SQL statements that ran for more than 1 second within the last 7 days. You can change the threshold by modifying the long_query_time parameter in parameter settings. Note
Slow log summary data is not collected in real time and may have a latency of 6 to 8 hours. |