Menu
Amazon Relational Database Service
User Guide (API Version 2014-10-31)

Amazon RDS Database Log Files

You can view, download, and watch database logs using the Amazon RDS console, the Command Line Interface (CLI), or the Amazon RDS API. Viewing, downloading, or watching transaction logs is not supported.

For engine-specific documentation, see the following:

Database EngineRelevant Documentation

MariaDB

You can access the error log, the slow query log, and the general log. For more information, see MariaDB Database Log Files.

Microsoft SQL Server

You can access SQL Server error logs, agent logs, and trace files. For more information, see SQL Server Database Log Files.

MySQL

You can access the error log, the slow query log, and the general log. For more information, see MySQL Database Log Files.

Oracle

You can access Oracle alert logs, audit files, and trace files. For more information, see Oracle Database Log Files.

PostgreSQL

You can access query logs and error logs. Error logs can contain auto-vacuum and connection information, as well as rds_admin actions. For more information, see PostgreSQL Database Log Files.

Viewing and Listing Database Log Files

You can view database log files for your DB engine by using the Amazon RDS console. You can list what log files are available for download or monitoring by using the Amazon RDS CLI or APIs.

Note

If you cannot view the list of log files for an existing Oracle DB instance, reboot the instance to view the list.

AWS Management Console

To view a database log file

  1. Sign in to the AWS Management Console and open the Amazon RDS console at https://console.aws.amazon.com/rds/.

  2. In the navigation pane, click Instances.

  3. Click the details icon next to the DB instance name that has the log file you want to view to show the DB instance details page.

    viewing log file
  4. On the DB instance details page, click the Recent Events & Logs tab.

    viewing log file
  5. Click the View button for the log you want to view.

    viewing log file
  6. Click DB Instances at the top of the page to return to the list of DB instances.

    viewing log file

CLI

To list the available database log files for a DB instance use the AWS CLI describe-db-log-files command.

The following example directs a list of log files for a DB instance named my-db-instance to a text file called log_file_list.txt.

Example

aws rds describe-db-log-files --db-instance-identifier my-db-instance > log_file_list.txt

API

To list the available database log files for a DB instance call the Amazon RDS API DescribeDBLogFiles action.

Downloading a Database Log File

You can use the Amazon RDS console or the AWS CLI to download a database log file.

You can download a complete log file using the DownloadCompleteDBLogFile REST API. Although the RDS CLI has been deprecated, you can continue to use the last published version of the RDS CLI and the rds-download-db-logfile command to download a complete log file.

AWS Management Console

To download a database log file

  1. Sign in to the AWS Management Console and open the Amazon RDS console at https://console.aws.amazon.com/rds/.

  2. In the navigation pane, click Instances.

  3. Click the details icon for the DB instance name that has the log file you want to view.

    viewing log file
  4. On the DB instance details page, click the Recent Events & Logs tab.

    viewing log file
  5. Click the Download button for the log you want to download.

    viewing log file
  6. Right-click the link provided, and then select Save Link As... from the dropdown menu. Type the location where you want the log file to be saved, then click Save. Click Close when you are finished.

    viewing log file
  7. Click DB Instances at the top of the page to return to the list of DB instances.

    viewing log file

CLI

To download a database log file use the command download-db-log-file-portion.

The following example shows how to download the contents of a log file called log/ERROR.4 and store it in a local file called errorlog.txt.

Example

For Linux, OS X, or Unix:

aws rds download-db-log-file-portion \
    --db-instance-identifier myexampledb \
    --no-paginate \
    --log-file-name log/ERROR.4 > errorlog.txt

For Windows:

aws rds download-db-log-file-portion ^
    --db-instance-identifier myexampledb ^
    --no-paginate ^
    --log-file-name log/ERROR.4 > errorlog.txt

Watching a Database Log File

You can monitor the contents of a log file by using the Amazon RDS console.

AWS Management Console

To watch a database log file

  1. Sign in to the AWS Management Console and open the Amazon RDS console at https://console.aws.amazon.com/rds/.

  2. In the navigation pane, click Instances.

  3. Click the details icon for the DB instance name that has the log file you want to view.

    viewing log file
  4. On the DB instance details page, click the Recent Events & Logs tab.

    viewing log file
  5. Click the Watch button for the log you want to watch.

    viewing log file
  6. Click DB Instances at the top of the page to return to the list of DB instances.

    viewing log file