This topic describes how to view the logs of an ApsaraDB RDS for MySQL instance in the ApsaraDB RDS console. The logs include error logs, slow query logs, and primary/secondary switchover logs. You can use the logs to troubleshoot issues on the RDS 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. Visit the RDS instance list, select a region above, and click the target instance ID.
  2. In the left-side navigation pane, click Logs.
  3. On the Logs page, click the Error Logs, Slow Log Details, Slow Log Summary, or Primary/Secondary Switching Logs tab, select a time range, and then click OK. You can also subscribe to binary logs on the Binlog Subscription tab of the Logs page.
    Tab Description
    Binlog Subscription Allows 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 (new).
    Error Logs Provides statistics about the database running errors that occurred over the last 30 days.
    Slow Log Details Provides details about the SQL statements that each took more than 1 second to run over the last 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 Summary Provides a summary of the SQL statements that each took more than 1 second to run over the last 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 log statistics are not collected in real time and may have a delay of 6 hours to 8 hours.
    Primary/Secondary Switching Logs Provides statistics about the primary/secondary switchovers that occurred over the last 30 days. Primary/secondary switchover logs are supported only for RDS instances that do not run the RDS Basic Edition.
    Note If an RDS instance resides in the China (Zhangjiakou) region, ApsaraDB RDS retains only the error logs that are generated over the last 9 days, slow query log details, and slow query log summary that are generated over the last 7 days of the RDS instance.