This topic describes how to manage logs through the RDS console and SQL statements. You can query error logs and slow query logs for fault analysis. All RDS instances except RDS for MySQL (Basic Edition) support log management.
- For information about log backup policies and rules, see Back up RDS data.
- For information about how to download log backup files, see Download data and log backup files.
- For information about how to restore data through log backup files, see:
Manage logs by using the RDS console
- MySQL 5.5/5.6/5.7/8.0
- SQL Server 2008 R2
- MariaDB TX
- Log on to the RDS console.
- Select the region where the target instance is located.
- Click the ID of the target instance to enter the Basic Information page.
- In the left-side navigation pane, click Log Management.
- On the Log Management page, select Error Log, Slow Query Log, Slow Query Log Summary, or Primary/Secondary Instance Switch Log, select a time range, and click Search.
Query item Content Error Log Records the SQL statements that are failed to be executed in the past month. Slow Query Log
- Records the SQL statements that lasted for over one second (for MySQL and MariaDB, you can modify this time threshold by modifying the long_query_time parameter in Parameters) in the past month. Similar SQL statements are displayed once only.
- The list does not include slow SQL logs of the past two hours. To query these logs, check the slow_log_view table in the MySQL database.
Slow Query Log Summary Provides statistics and analysis reports for SQL statements that lasted for over one second (For MySQL and MariaDB, you can modify this time threshold by modifying the long_query_time parameter in Parameters) in the past month. Primary/Secondary Instance Switch Log Available to instances of the MySQL High-availability Edition and MariaDB TX instances.
Manage logs by using SQL statements
- SQL Server 2012
- SQL Server 2016
- SQL Server 2017
Instances in SQL Server 2012 and SQL Server 2016 read error logs only through the
sp_rds_read_error_logs storage procedure. The method of using
sp_rds_read_error_logs is similar to that of using
EXEC sys.sp_readerrorlog 0,1 ,'error';
Instances in SQL Server 2017 read error logs through the
sp_readerrorlog storage procedure.