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

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






Satya shows you how to
enable slow query logs

rds-mysql-logs-Satya
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 Amazon Relational Database Service (Amazon RDS) instance running MySQL. 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, Amazon RDS API, Amazon RDS AWS Command Line Interface (AWS CLI), or AWS SDKs. The MySQL error log file is generated by default, and you can generate the slow query log and the general log. You can use the mysqlbinlog utility to download or stream any binary logs. For more information about configuring MySQL binary logging, see Binary Logging Format.

If you enable table logging, the amount of data written to the database can increase, which can also affect performance. For more information about table-based MySQL logs, see Managing Table-Based MySQL Logs.

First, create a custom DB parameter group, modify the parameter, and then associate the parameter group with your MySQL instance.

Create a DB parameter group

  1. Open the Amazon RDS console, and then choose Parameter groups from the navigation pane.
  2. Choose Create parameter group.
  3. From the Parameter group family drop-down list, select a DB parameter group family.
  4. For the Type, choose DB Parameter Group.
  5. Enter the name in the Group name field.
  6. Enter a description in the Description field.
  7. Choose Create.

Modify the new parameter group

  1. Open the Amazon RDS console, and then choose Parameter groups from the navigation pane.
  2. Choose the parameter group that you want to modify.
  3. Choose Parameter group actions, and choose Edit.
  4. Choose Edit parameters, and set the following parameters to these values:
    General_log = 1 (default value is 0 or no logging)
    Slow_query_log = 1 (default value is 0 or no logging)
    Long_query_time = 2 (to log queries that run longer than two seconds)
    log_output = FILE (to write both the general and the slow query logs to the file system and allow viewing these logs from the Amazon RDS console)
    log_output =TABLE (default value writes the queries to a table so you can view these logs with a query)
  5. Choose Save Changes.
    Note: You can't modify the parameter settings of a default DB parameter group. You can modify the parameter in a custom DB parameter group if Is Modifiable is set to true.

Associate the instance with the DB parameter group

  1. Open the Amazon RDS console, and then choose Instances from the navigation pane.
  2. Choose the instance that you want to associate with the DB parameter group.
  3. Choose Instance Actions, and then choose Modify.
  4. From Modify DB instance, select the DB parameter group that you want to associate with the DB instance.
    Note: The parameter group name changes and applies immediately, but parameter group isn't applied until you manually reboot the instance. Rebooting a DB instance results in a momentary outage, during which the DB instance status is set to rebooting.

Optional: Run the following command to query the log tables:

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

Did this page help you? Yes | No

Back to the AWS Support Knowledge Center

Need help? Visit the AWS Support Center.

Published: 2015-06-29

Updated: 2018-10-12