Getting RDS Logs For MySQL Into Honeycomb | Honeycomb

We use cookies or similar technologies to personalize your online experience & tailor marketing to you. Many of our product features require cookies to function properly.

Read our privacy policy I accept cookies from this site

Getting RDS Logs For MySQL Into Honeycomb

Amazon’s Relational Database Service (RDS) lets you use a number of databases without having to administer them yourself. The Honeycomb RDS connector gives you access to the same data as if you were running MySQL on your own server.

The Honeycomb RDS connector surfaces attributes like:

  • The normalized query shape
  • Time spent waiting to acquire lock
  • Number of rows examined to execute the query
  • Number of rows returned by MySQL
  • … and more!

Honeycomb allows you to calculate metrics and statistics on the fly while retaining the full-resolution log lines (and the original MySQL query that started it all).

Once you have got data flowing, be sure to take a look at our starter queries; our entry points provide our recommendations for comparing lock retention by normalized query, scan efficiency by collection, or read vs. write distribution by host.

Agentless Integration for MySQL Logs 

This integration is a Lambda function subscribed to your instance’s RDS Log Group. It parses log events as they arrive and submits them to Honeycomb. Note that configuring your RDS instance to send its logs to Cloudwatch will incur additional AWS costs - see the Cloudwatch Pricing docs for details.

Before You Install the Agentless Integration 

Before installing the integration, configure MySQL running on RDS to output the slow query log to a file. Refer to Amazon’s documentation on setting Parameter Groups to get started, and find more detail about the configuration options below in the MySQL docs for the slow query log.

Set the following options in the Parameter Group:

  • log_output to FILE
  • slow_query_log to 1
  • long_query_time to 0
  • log_queries_not_using_indexes to 1 (optional)

If you switch to a new Parameter Group when you make these changes, make sure you restart the database.

Note: Enabling slow query logs for all queries can generate a lot of log data, and can have an adverse impact on the performance of your RDS instance. If your database already has a lot of traffic, consider starting out by only logging longer queries (for example, setting long_query_time to 0.1 or higher) before logging everything. You may also wish to consider sampling your data.

Next, enable publishing of MySQL slow query logs to AWS Cloudwatch Logs. You can do this in the RDS console in the instance configuration. See the AWS docs for full details.

Configuring Cloudwatch Logs in RDS

This change can be done without instance downtime. Once you have made the above changes, verify that logs are being received by Cloudwatch Logs via the Cloudwatch Logs Console.

Install the Agentless Integration for Mysql Logs 

The MySQL integration exists as an AWS Lambda function deployed in your AWS account. It subscribes to the Cloudwatch Log Group created by RDS, parses log lines, and submits them as events to Honeycomb. You can view the source here.

To install the integration, you will need:

  • Access to your AWS account’s CloudFormation console
  • Permission to create an IAM role in your AWS account
  • Your Honeycomb API key

To get started, click this AWS quick-create link. This will launch the Cloudformation Stack creation wizard and will prompt you for a few key inputs:

  • The MySQL Cloudwatch Log Group(s) you wish to monitor for events.
  • Your Honeycomb API key (optionally encrypted).
  • The dataset that will be the destination for log events.

Installing MySQL Integration

Scrub Personally Identifiable Information From MySQL 

To hash the concrete query, set the ScrubQuery parameter to true when installing the integration. The normalized_query attribute will still be representative of the shape of the query and identifying patterns (including specific queries) will still be possible, but the sensitive information will be completely obscured before being submitted to our API.

Did you find what you were looking for?