elastic / logstash

Logstash - transport and process your logs, events, or other data
https://www.elastic.co/products/logstash
Other
14.2k stars 3.5k forks source link

NoMethodError: undefined method `[]=' for nil:NilClass #4375

Closed ruta-goomba closed 4 years ago

ruta-goomba commented 8 years ago

I'm using logstash-input-cloudwatch plugin and I've got the following config for logstash version 1.5.3:

input { cloudwatch { namespace => "AWS/EC2" metrics => [ "DiskReadOps", "CPUUtilization" ] filters => { "tag:monitored" => "Yes" } region => "eu-west-1" access_keyid => "**" secret_accesskey => "**" } }

output {
stdout { codec => rubydebug }
elasticsearch {
protocol => "http"
host => "127.0.0.1"
}
}

I've tried installing it with elasticsearch version 1.7.4 and 2.1.1, but in both cases logstash does not start and I get the following error in the logstash.err log:

NoMethodError: undefined method `[]=' for nil:NilClass receive at /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-output-elasticsearch-1.0.5-java/lib/logstash/outputs/elasticsearch.rb:493 handle at /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.3-java/lib/logstash/outputs/base.rb:88 output_func at (eval):27 outputworker at /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.3-java/lib/logstash/pipeline.rb:244 start_outputs at /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.3-java/lib/logstash/pipeline.rb:166

Thanks for your help.

andrewvc commented 8 years ago

Have you tried this with the latest version of logstash? Why are you still on 1.5.3?

On Sat, Dec 19, 2015 at 3:45 PM, ruta-goomba notifications@github.com wrote:

I'm using logstash-input-cloudwatch plugin and I've got the following config for logstash version 1.5.3:

input { cloudwatch { namespace => "AWS/EC2" metrics => [ "DiskReadOps", "CPUUtilization" ] filters => { "tag:monitored" => "Yes" } region => "eu-west-1" access_keyid => " " secret_accesskey => "" } }

output {

stdout { codec => rubydebug }

elasticsearch {

protocol => "http"

host => "127.0.0.1"

}

}

I've tried installing it with elasticsearch version 1.7.4 and 2.1.1, but in both cases logstash does not start and I get the following error in the logstash.err log:

NoMethodError: undefined method `[]=' for nil:NilClass receive at /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-output-elasticsearch-1.0.5-java/lib/logstash/outputs/elasticsearch.rb:493 handle at /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.3-java/lib/logstash/outputs/base.rb:88 output_func at (eval):27 outputworker at /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.3-java/lib/logstash/pipeline.rb:244 start_outputs at /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.3-java/lib/logstash/pipeline.rb:166

Thanks for your help.

— Reply to this email directly or view it on GitHub https://github.com/elastic/logstash/issues/4375.

ruta-goomba commented 8 years ago

yes, I've tried the latest version as well. With the latest version I get the following error (with both elasticsearch 2.1.1 and 1.7.4):

NoMethodError: private method `sprintf' called for #Hash:0x49c943c0 event_action_params at /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-output-elasticsearch-2.2.0-java/lib/logstash/outputs/elasticsearch/common.rb:129 event_action_tuple at /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-output-elasticsearch-2.2.0-java/lib/logstash/outputs/elasticsearch/common.rb:33 receive at /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-output-elasticsearch-2.2.0-java/lib/logstash/outputs/elasticsearch/common.rb:23 handle at /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-2.1.1-java/lib/logstash/outputs/base.rb:81 output_func at (eval):27 outputworker at /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-2.1.1-java/lib/logstash/pipeline.rb:277 start_outputs at /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-2.1.1-java/lib/logstash/pipeline.rb:194

ruta-goomba commented 8 years ago

My output file is different for the latest version, btw. It's:

output { stdout { codec => rubydebug } elasticsearch { hosts => ["localhost:9200"] } }

suyograo commented 8 years ago

@ruta-goomba can you paste a sample log line that comes out of logstash-input-cloudwatch?

ruta-goomba commented 8 years ago

As far as I am aware, the plugin does not produce separate logs. The error traces above are from /var/log/logstash/logstash.err

rhockenbury commented 8 years ago

@ruta-goomba

Any further progress or workarounds for this? I'm having the same issue with the logstash-input-cloudwatch plugin. I've tried using with the logstash-output-elasticsearch and logstash-output-amazon_es plugins. Both have errors as above.

ruta-goomba commented 8 years ago

I resolved the issue by rolling back the logstash-input-cloudwatch plugin version to 0.2.2. It works with logstash version 1.5.3 and elasticsearch version 1.7.4.

jrgns commented 8 years ago

@ruta-goomba Can you please try with the latest version of the logstash-input-cloudwatch plugin? 1.1.2 should fix the issues you've mentioned.

jsvd commented 4 years ago

closing this issue as we haven't received further reports of this problem and the ES output has significantly changed since the issue was created