Skip to main content
Collect logs from a self-hosted MySQL server β€” the error log and the slow query log β€” with the OpenTelemetry Collector. The same Collector can also forward traces and metrics from your apps β€” see Connect OpenTelemetry Collector to Bronto.

Prerequisites

Enable the slow query log in my.cnf to capture queries worth investigating:
my.cnf

Configure the Collector

Error and slow-query entries can span multiple lines. Use multiline keyed on the leading timestamp or the slow-log # Time: header:
/etc/otel/config.yaml
Set <REGION> to eu or us.

Metrics

The Collector Contrib mysql receiver collects connection, command, handler, query, buffer-pool, and replication metrics:
Add this receiver to the Bronto metrics pipeline. Use a least-privilege monitoring account and check the Collector Contrib MySQL receiver documentation for measurements that depend on your MySQL version.

What you will see in Bronto

Open Search and filter by service.name = mysql. The error log carries startup/shutdown, errors, and warnings (timestamp, thread ID, severity, subsystem); the slow query log carries each slow statement with Query_time, Lock_time, Rows_examined, and the SQL text. Bronto’s Custom Parser extracts these fields server-side.

Troubleshooting

  • Where are the logs? Run SHOW VARIABLES LIKE 'log_error'; and SHOW VARIABLES LIKE 'slow_query_log_file';. Adjust the include paths to match.
  • General query log: disabled by default and very verbose β€” enable (general_log = 1) only for short debugging sessions.
  • For general issues, see OTel Collector troubleshooting.

Alternative: Fluent Bit

If you already run Fluent Bit, tail the MySQL log files and forward them over HTTP:
fluent-bit.conf
Set Format to json_lines, not json. For slow-query entries that span lines, add a multiline.parser keyed on the # Time: header. See Connect Fluent Bit to Bronto.