theangryangel / logstash-output-jdbc

JDBC output for Logstash
MIT License
256 stars 101 forks source link

JDBC - Exception NoMethodError: Direct event field references have been disabled in favor of... #95

Closed saraserin closed 7 years ago

saraserin commented 7 years ago

Expected & Actual Behavior

I'm getting an exception message: JDBC - Exception. Not retrying. {:exception=>#<NoMethodError: Direct event field references (i.e. ev ent['field']) have been disabled in favor of using event get and set methods (e. g. event.get('field')). Please consult the Logstash 5.0 breaking changes documen tation for more details.>, :backtrace=>["C:/Users/xxxx/Downloads/logstash -5.5.2/logstash-core/lib/logstash/event.rb:48:in method_missing'", "C:/Users/xxxx/Downloads/logstash-5.5.2/vendor/local_gems/712609a2/logstash-output-jd bc-0.2.10/lib/logstash/outputs/jdbc.rb:290:inadd_statement_event_params'", "or g/jruby/RubyArray.java:1613:in each'", "org/jruby/RubyEnumerable.java:971:ine ach_with_index'", "C:/Users/xxxx/Downloads/logstash-5.5.2/vendor/local_ge ms/712609a2/logstash-output-jdbc-0.2.10/lib/logstash/outputs/jdbc.rb:288:in add _statement_event_params'", "C:/Users/xxxx/Downloads/logstash-5.5.2/vendor /local_gems/712609a2/logstash-output-jdbc-0.2.10/lib/logstash/outputs/jdbc.rb:23 5:insafe_flush'", "org/jruby/RubyArray.java:1613:in each'", "C:/Users/xxxx/Downloads/logstash-5.5.2/vendor/local_gems/712609a2/logstash-output-jdbc-0. 2.10/lib/logstash/outputs/jdbc.rb:232:insafe_flush'", "C:/Users/xxxx/Do wnloads/logstash-5.5.2/vendor/local_gems/712609a2/logstash-output-jdbc-0.2.10/li b/logstash/outputs/jdbc.rb:143:in flush'", "C:/Users/xxxx/Downloads/logs tash-5.5.2/vendor/bundle/jruby/1.9/gems/stud-0.0.23/lib/stud/buffer.rb:219:inb uffer_flush'", "org/jruby/RubyHash.java:1342:in each'", "C:/Users/xxxx/D ownloads/logstash-5.5.2/vendor/bundle/jruby/1.9/gems/stud-0.0.23/lib/stud/buffer .rb:216:inbuffer_flush'", "C:/Users/xxxx/Downloads/logstash-5.5.2/vendo r/bundle/jruby/1.9/gems/stud-0.0.23/lib/stud/buffer.rb:112:in buffer_initialize '", "org/jruby/RubyKernel.java:1479:inloop'", "C:/Users/xxxx/Downloads/ logstash-5.5.2/vendor/bundle/jruby/1.9/gems/stud-0.0.23/lib/stud/buffer.rb:110:i n `buffer_initialize'"]}

config is:

input { file{ path => "C:/Users/xxxx/Desktop/SAP-GLAE-GB-MULT-DAY.csv" start_position => beginning sincedb_path => "/dev/null" } }

filter {

csv {

columns => ["SSPCountry","CompanyCode","GLAccountNumber","IndicatorAccountIsaBalanceSheetAccount","TextComment","Accountisreconciliationaccount","Taxcode","PostingwithoutTaxAllowed","CompanyCodePostingBlock","PostatProfitCentre","PostatCostCentre","PostatSegment","PostatInternalOrder"]

separator => ";"
}

mutate {
convert => {  "GLAccountNumber" => "integer"  }
}

}

output { jdbc { driver_jar_path => 'C:\Users\xxxx\Downloads\Microsoft JDBC Driver 4.0 for SQL Server\sqljdbc_4.0\enu\sqljdbc4.jar' connection_string =>"jdbc:sqlserver://xxxx:1433;databaseName=RARE_TEST;user=xxxx;password=xxxx" statement => [ "INSERT INTO TEST VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", "SSPCountry","CompanyCode","GLAccountNumber","IndicatorAccountIsaBalanceSheetAccount","TextComment","Accountisreconciliationaccount","Taxcode","PostingwithoutTaxAllowed","CompanyCodePostingBlock","PostatProfitCentre","PostatCostCentre","PostatSegment","PostatInternalOrder"] } }

Environment

theangryangel commented 7 years ago

Please upgrade your plugin. 0.2.10 is not supported for v5, only v2, and is why you're getting this error.

You can install from rubygems using the logstash-plugin command.