Logstash Jdbc Input plugin for MYSQL

2019-05-14 05:52发布

问题:

I am using Logstash in windows. i was not able to install input jdbc plug so i downloaded the zip file manually and place the logstash folder from plugin in to my logstash-1.5.2 folder. the folder structure- "D:\elastic search\logstash-1.5.2\lib\logstash\inputs\jdbc.rb".

my conf file

input {
   jdbc {
     jdbc_driver_library => "D:/elastic search/logstash-1.5.2/lib/mysql-connector-java-5.1.13-bin.jar"
     jdbc_driver_class => "com.mysql.jdbc.Driver"
     jdbc_connection_string => "jdbc:mysql://localhost:3306/test"
     jdbc_user => "root"
    jdbc_password => ""
    statement => "SELECT * from data"
    jdbc_paging_enabled => "true"
    jdbc_page_size => "50000"
   }
 }

output {  
stdout { codec => rubydebug }
    elasticsearch { 
       embedded => true
       index => "bike"
       type => "bikeapp"
       cluster =>"trailcluster"
        protocol => "http"
       port => "9200"

    }
}

when i run the logstash i get the error

D:\elastic search\logstash-1.5.2\bin>logstash -f logtest.conf
io/console not supported; tty will not be manipulated
←[33mjdbc plugin doesn't have a version. This plugin isn't well
 supported by the community and likely has no maintainer. {:level=>:warn}←[0m
←[33mYou are using a deprecated config setting "type" set in elasticsearch. Deprecated settings will continue to work, but are scheduled for removal from logstash in the future. You can achieve this same behavior with the new
 conditionals, like: `if [type] == "sometype" { elasticsearch { ... } }`. If you have any questions about this, please visit the #logstash channel on freenode irc. {:name=>"type", :plugin=><LogStash::Outputs::ElasticSearch --
->, :level=>:warn}←[0m
LoadError: no such file to load -- sequel
                  require at org/jruby/RubyKernel.java:1072
                  require at D:/elastic search/logstash-1.5.2/vendor/bundle/jruby/1.9/gems/polyglot-0.3.5/lib/polyglot.rb:65
  prepare_jdbc_connection at D:/elastic search/logstash-1.5.2/lib/logstash/plugin_mixins/jdbc.rb:65
                 register at D:/elastic search/logstash-1.5.2/lib/logstash/inputs/jdbc.rb:144
             start_inputs at D:/elastic search/logstash-1.5.2/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.2.2-java/lib/logstash/pipeline.rb:148
                     each at org/jruby/RubyArray.java:1613
             start_inputs at D:/elastic search/logstash-1.5.2/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.2.2-java/lib/logstash/pipeline.rb:147
                      run at D:/elastic search/logstash-1.5.2/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.2.2-java/lib/logstash/pipeline.rb:80
              synchronize at org/jruby/ext/thread/Mutex.java:149
                      run at D:/elastic search/logstash-1.5.2/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.2.2-java/lib/logstash/pipeline.rb:80
                  execute at D:/elastic search/logstash-1.5.2/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.2.2-java/lib/logstash/agent.rb:150
                      run at D:/elastic search/logstash-1.5.2/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.2.2-java/lib/logstash/runner.rb:91
                     call at org/jruby/RubyProc.java:271
                      run at D:/elastic search/logstash-1.5.2/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.2.2-java/lib/logstash/runner.rb:96
                     call at org/jruby/RubyProc.java:271
               initialize at D:/elastic search/logstash-1.5.2/vendor/bundle/jruby/1.9/gems/stud-0.0.20/lib/stud/task.rb:12

回答1:

After adding the Jar file to Plugin fodler,You just goto the folder path in CMD Prompt and install the plugin using below commands to logstash

Run in an installed Logstash :

Build your plugin gem

gem build logstash-input-jdbc.gemspec

Install the plugin from the Logstash home

bin/plugin install /your/local/plugin/logstash-input-jdbc.gem

Finally you will, Start Logstash and proceed to test the plugin using the configuration you are using....



标签: jdbc logstash