This topic describes how to manage the error logs, slow query logs, and primary/secondary instance switching logs of an ApsaraDB RDS PostgreSQL instance through the ApsaraDB for RDS console or by calling API operations. The logs help you locate faults.

Note For more information about how to archive logs, see Back up the data of an RDS PostgreSQL instance and Download data and log backup files.

Precautions

Basic Edition RDS instances running PostgreSQL 10 do not support primary/secondary instance switching logs.

Procedure

  1. Log on to the ApsaraDB for RDS console.
  2. In the upper-left corner of the console, select the region where the target RDS instance resides.
  3. Find the target RDS instance and click its ID.
  4. In the left-side navigation pane, click Logs.
  5. On the Logs page that appears, click the Error Log, Slow Query Log, or Primary/Secondary Instance Switching Log tab, select a time range, and click Search.
    Tab Description
    Error Log Records database running errors that occurred within the last month.
    Slow Query Log Records SQL statements that each took more than 1 second to run within the last month. Duplicate SQL statements are deleted.
    Primary/Secondary Instance Switching Log Records switchovers between the primary and secondary instances triggered within the last month. This tab appears only if your RDS PostgreSQL instance is not in the Basic Edition.
    Note If your ApsaraDB RDS PostgreSQL instance resides in the China (Zhangjiakou-Beijing Winter Olympics) region, the system retains only error logs and slow query logs generated within the last nine days.

Related operations

Operation Description
DescribeSlowLogs Queries the list of slow query logs for an ApsaraDB for RDS instance.
DescribeSlowLogRecords Queries details about the slow query logs for an ApsaraDB for RDS instance.
DescribeErrorLogs Queries the error logs for an ApsaraDB for RDS instance.
DescribeBinlogFiles Queries the binary logs for an ApsaraDB for RDS instance.
DescribeSQLLogRecords Queries the SQL logs for an ApsaraDB for RDS instance.
DescribeSQLLogFiles Queries the list of SQL log files for an ApsaraDB for RDS instance.