This topic describes how to manage the error logs and slow query logs of an ApsaraDB RDS for PostgreSQL instance in the ApsaraDB RDS console or by using SQL statements.

Note Logs in this topic refer to error logs and slow query logs. For more information about archived logs, see Back up an ApsaraDB RDS for PostgreSQL instance and Download the backup files of an ApsaraDB RDS for PostgreSQL instance.

Precautions

None.

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 tab or the Slow Log Details tab. Then, select a time range and click OK.
    Tab Description
    Error Logs Records the database running errors that occurred over the most recent 30 days.
    Slow Log Details Records the SQL statements that took longer than 1 second to execute over the most recent seven days. Duplicate SQL statements are removed.
    Note
    • If the RDS instance resides in the China (Zhangjiakou) region, only the error logs and slow query logs that were generated over the most recent nine days are retained.
    • ApsaraDB RDS collects SQL audit logs from databases and saves the SQL audit logs as CSV files to a log server. You can use the rds_max_log_files parameter to specify the maximum number of SQL audit log files that can be retained. A larger number of SQL audit log files that are retained indicates a longer period of time that is required to complete a query and a larger amount of storage that is occupied.

Related operations

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