This topic describes how to view the error logs and slow query logs of an ApsaraDB RDS for MySQL instance in the ApsaraDB RDS console. You can use the logs to troubleshoot issues on the RDS instance.

Note Logs in this topic refer to error logs and slow query logs. For more information about binary logs, see Enable the automatic backup feature for an ApsaraDB RDS for MySQL instance and Download the backup files of an ApsaraDB RDS for MySQL instance.

For more information about how to view the logs of an RDS instance that runs a different database engine, see the following topics:

Procedure

  1. Access RDS Instances, select a region at the top, and then click the ID of the target RDS instance.
  2. In the left-side navigation pane, click Logs.
  3. On the Logs page, click the Error Logs, Slow Log Details, or Slow Log Summary tab, select a time range, and click OK. The following table describes the tabs that are displayed on the Logs page.
    TabDescription
    Binlog SubscriptionAllows you to subscribe to binary logs by using Data Transmission Service (DTS). For more information, see Track data changes from an ApsaraDB RDS for MySQL instance.
    Error LogsProvides statistics about the database running errors that occurred over the most recent 30 days.
    Slow Log DetailsProvides details about the SQL statements that each took more than 1 second to run over the most recent 7 days. Duplicate SQL statements are removed. You can change the 1-second threshold by reconfiguring the long_query_time parameter. For more information, see Reconfigure the parameters of an ApsaraDB RDS for MySQL instance.
    Note This tab is refreshed once every minute.
    Slow Log SummaryProvides a summary of the SQL statements that each took more than 1 second to run over the most recent 7 days and allows you to export the summary as a report file. You can change the 1-second threshold by reconfiguring the long_query_time parameter. For more information, see Reconfigure the parameters of an ApsaraDB RDS for MySQL instance.
    Note Slow query logs are not collected in real time and may show a latency of 6 hours to 8 hours.
    Note If an RDS instance resides in the China (Zhangjiakou) region, ApsaraDB RDS retains only the error logs that are generated over the most recent nine days and the details and summary of the slow query logs that are generated over the most recent seven days for the RDS instance.