This topic describes how to query error logs, slow query logs, and primary/secondary switching logs of an ApsaraDB RDS for PostgreSQL instance by using the ApsaraDB for RDS console or SQL statements.
Primary/secondary switching logs are not available in the Basic Edition.
- Visit the RDS instance list, select a region above, and click the target instance ID.
- In the left-side navigation pane, click Logs.
- On the Logs page, click the Error Logs, Slow Query Logs, or Primary/Secondary Switching Logs tab, select a time range, and click Search.
Item Description Error logs Record database running errors that occurred in the last month. Slow query logs Record SQL statements that take more than one second to execute in the last month. Duplicated SQL statements are removed. Primary/secondary switching logs Record switchovers between the primary and secondary instances in the last month. Primary/secondary switching logs are available only for RDS instances that are not in the Basic Edition.Note
- If your RDS instance resides in the China (Zhangjiakou-Beijing Winter Olympics) region, the system only retains error logs and slow query logs generated in the last nine days.
- The system collects logs from databases and saves the CSV log files to a log server. If you want to adjust the maximum number of retained log files, configure the rds_max_log_files parameter for the RDS instance. If more log files are retained, you can query logs in a longer time range. However, the log files occupy larger storage space.
|DescribeSlowLogs||Queries the list of slow query logs.|
|DescribeSlowLogRecords||Queries details about slow query logs.|
|DescribeErrorLogs||Queries error logs.|
|DescribeBinlogFiles||Queries binary logs.|
|DescribeSQLLogRecords||Queries details about SQL audit logs.|
|DescribeSQLLogFiles||Queries the list of SQL audit logs.|