logstash-input-jdbc:“未知设置' jdbc_driver_libary'对于jdbc {:level =>:error}“

时间:2016-10-04 16:33:38

标签: logstash logstash-input-jdbc

我尝试使用logstash访问MySQL服务。我安装了logstash-input-jdbc( / opt / logstash / bin / logstash-plugin install logstash-input-jdbc )并创建了 /etc/logstash/conf.d/sample.conf < /强>:

input{
 lumberjack{
 ...
 }
 jdbc{
        type => "jdbc_hfc"
        jdbc_connection_string => "jdbc:mysql://127.0.0.1:3306/test"
        jdbc_user => "root"
        jdbc_password => ""
        jdbc_validate_connection => true
        jdbc_driver_libary => "mysql-connector-java-5.1.40-bin.jar"
        jdbc_driver_class => "com.mysql.jdbc.Driver"
        statement => "SELECT * FROM hfc"
        schedule => "00 07 * * *"
 }
 file{
 ...
 }
}
output{
  if [type] == "jdbc_hfc"
  {
    elasticsearch{
        protocl => http
        hosts => ["localhost:9200"]
        index => "logstash-jdbc-hfc-%{+YYYY.MM.dd}"
    }
  }
}

当我执行configtest( / opt / logstash / bin / logstash --configtest -f /etc/logstash/conf.d/sample.conf )时,我收到下一个错误:< / p>

Unknown setting 'jdbc_driver_libary' for jdbc {:level=>:error}
The given configuration is invalid. Reason: Something is wrong with your configuration. {:level=>:fatal}

当我评论jdbc_connection_string行时,configtest返回:

Configuration OK

但是当我执行sample.conf文件时,logstash重新导致了下一个错误:

Pipeline aborted due to error {:exception=>"LogStash::ConfigurationError", :backtrace=>["/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-input-jdbc-4.1.1/lib/logstash/plugin_mixins/jdbc.rb:159:in `prepare_jdbc_connection'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-input-jdbc-4.1.1/lib/logstash/inputs/jdbc.rb:187:in `register'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-2.4.0-java/lib/logstash/pipeline.rb:330:in `start_inputs'", "org/jruby/RubyArray.java:1613:in `each'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-2.4.0-java/lib/logstash/pipeline.rb:329:in `start_inputs'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-2.4.0-java/lib/logstash/pipeline.rb:180:in `start_workers'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-2.4.0-java/lib/logstash/pipeline.rb:136:in `run'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-2.4.0-java/lib/logstash/agent.rb:491:in `start_pipeline'"], :level=>:error}

我的错误在哪里?我该怎么做才能解决这个问题?

非常感谢和最诚挚的问候。

PD:如果您需要更多信息,请问我。

1 个答案:

答案 0 :(得分:0)

第一个错误说明了一切:

Unknown setting 'jdbc_driver_libary' for jdbc {:level=>:error}

所以你的配置中只有一个拼写错误:

    jdbc_driver_libary => "mysql-connector-java-5.1.40-bin.jar"

应该阅读

    jdbc_driver_library => "mysql-connector-java-5.1.40-bin.jar"
                   ^
                   |