Use the ApsaraDB RDS console to view error logs and slow query logs for an ApsaraDB RDS for MySQL instance. These logs help you identify and troubleshoot database issues such as runtime errors and slow-performing SQL statements.
This topic covers error logs and slow query logs only. For binary logs, see Configure automatic backup and Download backup. For logs on other database engines, see the topics for ApsaraDB RDS for SQL Server, ApsaraDB RDS for PostgreSQL, and ApsaraDB RDS for MariaDB.
Log types
The Logs page in the ApsaraDB RDS console provides the following tabs:
| Tab | What it shows | Retention |
|---|---|---|
| Error Logs | Database runtime errors over the most recent 30 days. | 30 days (9 days in China (Zhangjiakou)) |
| Slow Log Details | Individual SQL statements that exceeded the long_query_time threshold (default: 1 second), deduplicated, over the most recent 7 days. Refreshed every minute. |
7 days |
| Slow Log Summary | Aggregated summary of slow SQL statements over the most recent 7 days. Exportable as a report. Updated with a 6–8 hour delay. | 7 days |
| Binlog Subscription | Subscribe to binary logs via Data Transmission Service (DTS). | — |
Error logs do not include deadlock logs. To view deadlock logs, go to Autonomy Services > Diagnostics on the instance details page and click the Lock Analysis tab to view deadlock logs.
Before you begin
-
Slow query threshold: Both Slow Log Details and Slow Log Summary capture SQL statements that exceed the
long_query_timethreshold, which defaults to 1 second. To change the threshold, modify thelong_query_timeparameter. For details, see Modify instance parameters. -
Slow Log Summary delay: Data in the Slow Log Summary tab is not real-time. Expect a delay of 6–8 hours before new data appears.
-
China (Zhangjiakou) region: Error logs are retained for 9 days; slow query logs are retained for 7 days.
View logs
-
Log on to the ApsaraDB RDS console. On the Instances page, select the region where your instance resides, then click the instance ID.
-
In the left-side navigation pane, click Logs.
-
Click the Error Logs, Slow Log Details, or Slow Log Summary tab, select a time range, and click OK.
FAQ
What's next
-
To adjust the slow query threshold, modify the
long_query_timeparameter for the instance. -
To view deadlock logs, go to Autonomy Services > Diagnostics > Lock Analysis.