Good Moring, I'm trying to grab data from MySQL database and send it to elasticsearch, so I could create graph's in Kibana and display it.
I'm using the elasticsearch-jdbc plugin with this config:
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 => "jdbc:mysql://localhost:3306/DB_NAME"
jdbc_user => "USER"
jdbc_password => "PASSWORD"
schedule => "* * * * *"
statement => "SELECT * from eps"
}
}
output {
elasticsearch {
hosts => ["localhost:9200"]
sniffing => false
index => "eps"
document_type => "eps"
document_id => "%{uid}"
}
}
And without success. When I'm looking at the /var/log/logstash/logstash-plain.log I get this error:
[2016-11-17T11:54:17,592][ERROR][logstash.agent ] fetched an invalid config {:config=>"input {\n beats {\n port => 5044\n y\n }\n}\n\noutput {\n elasticsearch {\n hosts => [\"localhost:9200\"]\n manage_template => false\n index => \"%{[@metadata][beat]}-%{+YYYY.MM.dd}\"\n document_type => \"%{[@metadata][type]}\"\n }\n}\n\ninput {\n jdbc {\n jdbc_driver_library => \"/home/USERNAME/mysql-connector-java-5.1.40/mysql-connector-java-5.1.40-bin.jar\"\n jdbc_driver_class => \"com.mysql.jdbc.Driver\"\n jdbc_connection_string => \"jdbc:mysql://localhost:3306/DB_NAME\"\n jdbc_user => \"USER\"\n jdbc_password => \"PASSWORD\"\n schedule => \"* * * * *\"\n statement => \"SELECT * from eps\"\n }\n}\n\noutput {\n elasticsearch {\n hosts => [\"localhost:9200\"]\n sniffing => false\n index => \"eps\"\n document_type => \"eps\"\n document_id => \"%{uid}\"\n }\n}\n\n", :reason=>"Expected one of #, => at line 5, column 2 (byte 42) after input {\n beats {\n port => 5044\n y\n "}
I have created new id name using:
curl -XPUT 'localhost:9200/river/my_jdbc_river/_meta' -d '{
> "type" : "jdbc",
> "jdbc" : {
> "url" : "jdbc:mysql://localhost:3306/MY_DB",
> "user" : "USER",
> "password" : "PASSWORD",
> "sql" : "select * from eps"
> }
> }'
I have changed for this post the USERNAME and PASSWORD, but I made sure - and they work. it's not that.
Any idea what I'm doing wrong? Thanks Idan