好Moring, 我正试图从MySQL数据库中获取数据并将其发送到elasticsearch,因此我可以在Kibana中创建图形并显示它。
我正在使用带有此配置的elasticsearch-jdbc插件:
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}"
}
}
没有成功。 当我查看/var/log/logstash/logstash-plain.log时 我收到这个错误:
[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 "}
我使用以下方法创建了新的ID名称:
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"
> }
> }'
我已经更改了这篇文章的USERNAME和PASSWORD,但我确定 - 他们的工作。不是那样的。
知道我做错了什么吗? 谢谢 伊詹
答案 0 :(得分:1)
错误消息显示您的配置无效。
从错误消息中,我们有:
input {
beats {
port => 5044
y
}
}
y
此处无关,问题来自于此。它也出现在错误消息的末尾。