Closed evgygor closed 9 years ago
Actually, I tried the solution from http://stackoverflow.com/questions/3731920/undefined-method-to-json-for-hash0x3d3cef0-nomethoderror-in-activesuppor
=> Adding require "active_support/core_ext" to the influxdb.rb.
I retested the issue - no errors in log file, data arrived to the influxdb as well.
Thanks
@evgygor I tried your solution with logstash 1.2 rc2 and I can't successfully run Influxdb anymore. Here's my error:
" Couldn't find any output plugin named 'influxdb'. Are you sure this is correct? Trying to load the influxdb output plugin resulted in this error: no such file to load -- active_support/core_ext"
Without the fix you recommended, Logstash starts and takes input but the error I'm getting is this:
Failed to flush outgoing items {:outgoing_count=>1, :exception=>#<NoMethodError: undefined method to_json' for #<Array:0x5ff935cb>>, :backtrace=>["/logstash15/vendor/bundle/jruby/1.9/gems/logstash-output-influxdb-0.1.3/lib/logstash/outputs/influxdb.rb:190:in
flush'", "/logstash15/vendor/bundle/jruby/1.9/gems/stud-0.0.19/lib/stud/buffer.rb:219:inbuffer_flush'", "org/jruby/RubyHash.java:1341:in
each'", "/logstash15/vendor/bundle/jruby/1.9/gems/stud-0.0.19/lib/stud/buffer.rb:216:inbuffer_flush'", "/logstash15/vendor/bundle/jruby/1.9/gems/stud-0.0.19/lib/stud/buffer.rb:193:in
buffer_flush'", "/logstash15/vendor/bundle/jruby/1.9/gems/stud-0.0.19/lib/stud/buffer.rb:159:inbuffer_receive'", "/logstash15/vendor/bundle/jruby/1.9/gems/logstash-output-influxdb-0.1.3/lib/logstash/outputs/influxdb.rb:155:in
receive'", "/logstash15/lib/logstash/outputs/base.rb:88:inhandle'", "(eval):27:in
initialize'", "org/jruby/RubyProc.java:271:incall'", "/logstash15/lib/logstash/pipeline.rb:279:in
output'", "/logstash15/lib/logstash/pipeline.rb:235:inoutputworker'", "/logstash15/lib/logstash/pipeline.rb:163:in
start_outputs'"], :level=>:warn}
Can anyone help with this, please?
logstash 1.2 rc2 ? not 1.5?
@evgygor pardon, I meant 1.5
I fixed the error by adding the json dependency to the influxdb.rb file
require "json"
@xpajaro thanks for debugging. Could you please create a PR for this and we can merge it in?
@suyograo it was already done here: https://github.com/logstash-plugins/logstash-output-influxdb/pull/8
That is a solution.
I'm using logstash-1.5.0.beta1-1. The following errors appears in log file:
{:timestamp=>"2015-01-08T17:23:38.518000+0200", :message=>"Failed to flush outgoing items", :outgoing_count=>100, :exception=>#<NoMethodError: undefined method
to_json' for #<Array:0x1b9a67a3>>, :backtrace=>["/opt/logstash/lib/logstash/outputs/influxdb.rb:191:in
flush'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/stud-0.0.18/lib/stud/buffer.rb:219:inbuffer_flush'", "org/jruby/RubyHash.java:1341:in
each'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/stud-0.0.18/lib/stud/buffer.rb:216:inbuffer_flush'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/stud-0.0.18/lib/stud/buffer.rb:193:in
buffer_flush'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/stud-0.0.18/lib/stud/buffer.rb:159:inbuffer_receive'", "/opt/logstash/lib/logstash/outputs/influxdb.rb:156:in
receive'", "/opt/logstash/lib/logstash/outputs/base.rb:86:inhandle'", "(eval):255:in
initialize'", "org/jruby/RubyArray.java:1613:ineach'", "org/jruby/RubyEnumerable.java:805:in
flat_map'", "(eval):252:ininitialize'", "org/jruby/RubyProc.java:271:in
call'", "/opt/logstash/lib/logstash/pipeline.rb:272:inoutput'", "/opt/logstash/lib/logstash/pipeline.rb:231:in
outputworker'", "/opt/logstash/lib/logstash/pipeline.rb:160:in`start_outputs'"], :level=>:warn}My conf file: input { file { path => [ "/opt/jmeter/bin/attsec.csv"] start_position => "beginning" type => "jmeter" } }
filter { if ([message] =~ "responseCode") { drop { } } else { csv { columns => ["timeStamp","elapsed","label","responseCode","responseMessage", "threadName","success","failureMessage","bytes","Latency", "SampleCount","ErrorCount","Hostname","IdleTime"] remove_field => ["timeStamp","responseMessage","threadName","failureMessage", "SampleCount","ErrorCount","Hostname"] add_field => { "time" => "%{timeStamp}" } } } }
output { influxdb { host => "172.20.90.72" password => "root" user => "root" db => "metrics" series => "%{label}" allow_time_override => true time_precision => "m" coerce_values => { "time" => "integer" "elapsed" => "integer" "Latency" => "integer" "bytes" => "integer" "IdleTime" => "integer" } data_points => { "time" => "%{time}" "elapsed" => "%{elapsed}" "Latency" => "%{Latency}" "bytes" => "%{bytes}" "IdleTime" => "%{IdleTime}" "responseCode" => "%{responseCode}" "success" => "%{success}" } } }