- 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!
This document is for running MySQL directly.
If running MySQL on RDS, Honeycomb offers support for ingesting RDS MySQL logs via CloudWatch Logs with the option to convert these unstructured logs into structured logs.
honeytail.
Configure MySQL Query Logging
Before runninghoneytail, you will want to turn slow query logging on for all queries if possible.
To turn on slow query logging for your MySQL host, run the following in your MySQL shell:
0 (the default is 10):
If this technique is a problem for you—specifically, you do not want to rely on slow query log output—let us know!
We have got something in the works that might satisfy your needs.
Install and Run Honeytail
On your MySQL host, download and install the latesthoneytail by running:
- deb-amd64
- deb-arm64
- rpm
- bin-linux-amd64
- bin-linux-arm64
- bin-darwin-amd64
- source
Download the Verify the package.Install the package.The packages install
honeytail_1.10.0_amd64.deb package.honeytail, its config file /etc/honeytail/honeytail.conf,
and some start scripts.
Build honeytail from source if you need it in an unpackaged form or for ad-hoc use.honeytail.
To consume the current MySQL slow query log from the beginning, run:
Troubleshooting
Check outhoneytail Troubleshooting for debugging tips.
Run Honeytail Continuously
To runhoneytail continuously as a daemon process, first modify the config file /etc/honeytail/honeytail.conf and uncomment and set:
ParserNametomysqlWriteKeyto your API key, available from the account pageLogFilesto the path for your MySQL slow query log file, often located at/usr/local/var/mysql/myhost-slow.logDatasetto the name of the dataset you wish to create with this log file.
honeytail using upstart or systemd:
- upstart
- systemd
Backfill Archived Logs
You may have archived logs that you would like to import into Honeycomb. If you have a MySQL logfile located at/usr/local/var/mysql/myhost-slow.16.log, you can backfill using this command:
honeytail’s backfill behavior here.
honeytail does not unzip log files, so you will need to do this before backfilling.Scrub Personally Identifiable Information
While we believe strongly in the value of being able to track down the precise query causing a problem, we understand the concerns of exporting log data, which may contain sensitive user information. With that in mind, we recommend usinghoneytail’s MySQL parser, but adding a --scrub_field=query flag to hash the concrete query value.
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 leaving your servers.
More information about dropping or scrubbing sensitive fields can be found here.
Example Extracted MySQL Fields
Ingesting a MySQL log line (resulting from aSELECT with a JOIN):
mysqltools repository.