You can query error logs and slow query logs in the console or use SQL to troubleshoot issues.
This topic covers the error log and the slow query log. For information about archived logs, see Back up ApsaraDB RDS for PostgreSQL data and Download a backup file.
Usage notes
-
Slow query log integrity: Under extreme conditions, slow query log records may be incomplete or lost:
-
The instance experiences performance bottlenecks.
-
The instance receives a high volume of SQL requests.
-
The component that collects slow query logs is malfunctioning.
-
View logs
Log on to the ApsaraDB RDS console and go to the Instances page. In the top navigation bar, select the region in which the RDS instance resides. Then, find the RDS instance and click the instance ID.
-
In the left-side navigation pane, click Logs.
-
On the Logs page, select Logs or Logs. Then, select a time range. The system displays the log details for the specified time period.
Type
Description
Error log
Records database errors from the last month.
Slow query log details
Records SQL statements from the last 7 days that took more than 1 second to execute. Similar statements are de-duplicated.
Note-
For instances in the China (Zhangjiakou) region, only the error logs and slow query log details from the last 9 days are retained.
-
The system collects content from csvlog files in the database and saves it to a log server. To adjust the maximum number of retained csvlog files, you can modify the rds_max_log_files instance parameter. Retaining more csvlog files allows you to query a longer time range but consumes more storage space.
-
API reference
|
API |
Description |
|
Queries slow query logs. |
|
|
Queries slow query log details. |
|
|
Queries error logs for an instance. |
|
|
Queries the write-ahead log (WAL) files for an instance. |
|
|
Queries SQL audit logs for an instance. |
|
|
Queries the SQL audit log files for an instance. |