Mysql query in mysql moudle


#1

Hello,
I want to send a specific query from Mysql DB to the elasticsearch and then display in Kibana.
I have looked into the MySQL Moudle in Metricbeats, I can't figure out how to send specific query to the elastic search.

Any help please?

Thank you


(David Pilato) #2

I don't understand what you want to do and how this could be related to metricbeat


#3

I may be confusing a few things.
My goal is to display a query from MySQL in Kibana
I have a MySQL query - for example: "select * from bla", I want to display the result in kibana,
The reason I want to Metricbeat, it's because I want saw it have the 'MySQL moudle' , and I hoped to find my answer there.
If i'm complete wrong, please le me know.

Thank you
Idan


(David Pilato) #4

You can't run SQL queries in elasticsearch.
You can run elasticsearch queries in elasticsearch.


(Christian Dahlqvist) #5

Metricbeat collects statistics from MySQL, not data or queries. You can see an example of the statistics collected here. If you want to export data from MySQL and index it into Elasticsearch so you can visualise it in Kibana, you should look at Logstash and the JDBC input plugin.


#6

Thank you,
That what I was looking at the moment, Just wanted to make sure this is the path I needed to take.


#7

I'm trying to use the JDBC plugin has you recommended
I get this error:
[2016-11-15T14:16:28,314][ERROR][logstash.agent ] fetched an invalid config

This is my config file:

input {
  jdbc {
    jdbc_driver_library => "/home/USERNAME/mysql-connector-java-5.1.40/mysql-connector-java-5.1.40-bin.jar"
    jdbc_driver_class => "com.mysql.jdbc.Driver"
    jdbc_connection_string => "USERNAME:PASSWORD://localhost:3306/mydb"
    jdbc_user => "USERNAME"
    schedule => "* * * * *"
    statement => "SELECT * from TABLE"
  }
}

output {
  elasticsearch {
       hosts => ["localhost:9200"]
       sniffing => false
       }
}

No success..
Any help?


(system) #8

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.