In the video at left,
Satya shows you how to
manage RDS logs

In the video at right,
Satya walks you through
enabling general logs

In the video at left,
Satya shows you how to
enable slow query logs

In the video at right,
Ebrahim shows you how to
view RDS SQL Server logs

rds-mysql-logs-Satya
aws-kc-slate
aws-kc-slate
rds-mysql-logs-ebrahim

I need to enable and monitor the error log, the slow query log, and the general log for an instance of MySQL on Amazon RDS. How can I do this?

You can monitor the MySQL error log, the slow query log, and the general log directly through the Amazon RDS console, the Amazon RDS API, the Amazon RDS CLI, or the AWS SDKs. The MySQL error log file is generated by default; you can generate the slow query and general logs by setting parameters in a DB parameter group that you create for your MySQL instance(s). MySQL on Amazon RDS supports both the row-based and mixed binary logging formats for MySQL version 5.6. The default binary logging format is mixed. For more information about configuring MySQL binary logging, see MySQL Database Log Files - Binary Logging Format.

Note
A default DB parameter group is created if you create a DB instance without specifying a DB parameter group that you create. This group contains database engine defaults and Amazon RDS system defaults based on the engine, compute class, and allocated storage of the instance. You cannot modify the parameter settings of a default DB parameter group; you must create your own DB parameter group to change parameter settings from their default value. Note that not all DB engine parameters can be changed in a DB parameter group that you create.

  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, choose Parameter Groups.
  3. Choose Create Parameter Group. The Create Parameter Group window appears.
  4. For Parameter Group Family, choose the parameter group family.
  5. For Group Name, type the name of the new DB parameter group.
  6. For Description, type a description for the new DB parameter group.
  7. Choose Create.

Important
After you create a DB parameter group, you should wait at least 5 minutes before creating your first DB instance that uses that DB parameter group.

For more information about creating a DB parameter group, see Working with DB Parameter Groups - Creating a DB Parameter Group.

  1. In the navigation pane, choose Parameter Groups. The available DB parameter groups appear in a list.
  2. In the list, select the parameter group you want to modify.
  3. Choose Edit Parameters and set the following parameters to the specified values:
        General_log = 1 (default is 0 or no logging)
        Slow_query_log =1 (default is 0 or no logging)
        Long_query_time = 2, which will log queries that take longer than 2 seconds to run.
        log_output=FILE, to allow viewing the logs from the console.
        log_output=TABLE, to allow viewing logs with a query.
  4. Choose Save Changes.

For more information about the parameters that control MySQL slow query and general logging, see MySQL Database Log Files.

Important
After you modify a DB parameter group, you should wait at least 5 minutes before creating your first DB instance that uses that DB parameter group.

For information about modifiying a DB parameter group, see Working with DB Parameter Groups - Modifying Parameters in a DB Parameter Group.

  1. In the navigation pane, choose Instances.
  2. Select the DB instance you want to associate with a DB parameter group.
  3. On the Instance Actions menu, choose Modify.
  4. In the Modify DB Instance dialog box, under Database Options, choose the parameter group you want to associate with the DB instance. Changing this setting does not result in an outage. The parameter group name changes immediately, but the actual parameter changes are not applied until you reboot the instance without failover.
  5. Apply changes by rebooting the instance.
  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, choose Instances.
  3. Select the details icon next to the DB instance name that has the log file you want to view.
  4. On the DB instance details page, open the Recent Events & Logs view.
  5. For the log you want to view, choose View.
  6. To return to the list of DB instances, choose Close, and then choose DB Instances at the top of the page.

For more information about viewing file-based MySQL logs with the Amazon RDS console, see Viewing and Listing Database Log Files – AWS Management Console.

For information about accessing the MySQL slow query and general logs, see MySQL Database Log Files - Accessing the MySQL Slow Query and General Logs.

For information about accessing MySQL error logs, see MySQL Database Log Files - Accessing MySQL Error Logs.

    Select * from mysql.slow_log
    Select * from mysql.general_log

Note
Log tables keep growing until the respective logging activities are turned off. Enabling table logging increases the amount of data written to the database, which can degrade performance. For information about managing table-based MySQL logs, see MySQL Database Log Files - Managing Table-Based MySQL Logs.

Additionally, you can use the mysqlbinlog utility to download or stream any binary logs from Amazon RDS instances running MySQL 5.6. For more information about accessing MySQL 5.6 binary logs with the mysqlbinlog utility, see MySQL Database Log Files - Accessing MySQL 5.6 Binary Logs.


Did this page help you? Yes | No

Back to the AWS Support Knowledge Center

Need help? Visit the AWS Support Center.