Skip to content

How do I publish logs for Amazon RDS for MySQL or Amazon Aurora MySQL instances to CloudWatch?

2 minute read
0

I use an Amazon Relational Database Service (Amazon RDS) for MySQL or an Amazon Aurora MySQL-Compatible Edition instance. I want to view my DB instance logs in Amazon CloudWatch.

Resolution

Allow logging on your DB instance

For Amazon RDS, modify the parameters for the general_log and slow_query_log in a custom DB parameter group that's associated with the DB instance. To allow audit logging, add the MariaDB Audit Plugin to your custom option group. For more information, see How do I activate and monitor logs for an Amazon RDS for MySQL DB instance?

For Aurora MySQL-Compatible DB clusters, modify the parameters for the general_log and slow_query_log. Use a custom DB cluster parameter group to allow Advanced Auditing to audit the logs for your Aurora DB clusters.

Publish logs to CloudWatch

To publish logs to CloudWatch, configure log exports on the DB cluster.

Note: Aurora publishes the log types that you selected for all instances of the Aurora DB cluster.

Change the value of the log_output parameter to FILE

For Aurora clusters that are on version 2 (MySQL 5.7 compatible), the log_output parameter value is set to FILE by default. However, if you manually modified the log_output parameter value to TABLE, then you must change the value to FILE.

To change the log_output parameter, complete the following steps:

  1. Open the Amazon RDS console.
  2. In the navigation pane, choose Parameter groups.
  3. Select the parameter group that's associated with the instance that you want to publish logs for.
  4. Choose Parameter group actions, and then choose Edit.
  5. Use the Filter parameters field to search for the log_output parameter.
  6. Set the value of the log_output parameter to FILE.
  7. Choose Save changes.
    Note: You don't need to restart the instance to implement the change because the parameter is dynamic. For more information, see Default and custom parameter groups.

Related information

How do I modify the values of an Amazon RDS DB parameter group?

MySQL database log files

AWS OFFICIALUpdated 9 months ago