Slow queries can degrade the overall performance of a MySQL cluster, so they need to be monitored closely and addressed promptly.
Fluentd can be set up to parse and collect data from MySQL's slow query logs. Applications include:
Install the MySQL slow query plugin by running the following command
$ fluent-gem install fluent-plugin-mysqlslowquery
Open your Fluentd configuration file and add the following lines:
<source>
type mysql_slow_query
path /path/to/mysqld-slow.log
tag mysqld.slow_query
</source>
For example, in most cases, the slow query log is located at /var/log/mysql/slow.log
, so the above config would be
<source>
type mysql_slow_query
path /var/log/mysql/slow.log
tag mysqld.slow_query
</source>
If you are not sure where you slow query logs are, ask the DBA or look into my.cnf
It's time to configure data outputs. Here are some examples.
Want to learn the basics of Fluentd? Check out these pages.
Couldn't find enough information? Let's ask the community!
You need commercial-grade support from Fluentd committers and experts?
©2010-2024 Fluentd Project. ALL Rights Reserved.
Fluentd is a hosted project under the Cloud Native Computing Foundation (CNCF). All components are available under the Apache 2 License.