logstash-plugins / logstash-input-gelf

Apache License 2.0
20 stars 39 forks source link

gelf listener died: NoMethodError: undefined method `[]=' for nil:NilClass #43

Closed sandrinr closed 8 years ago

sandrinr commented 8 years ago

Hi

I am getting this error in Logstash:

{:timestamp=>"2016-07-21T13:35:35.465000+0000", :message=>"gelf listener died",
:exception=>#<NoMethodError: undefined method `[]=' for nil:NilClass>,
:backtrace=>["/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-input-gelf-2.0.7/lib/logstash/inputs/gelf.rb:130:in `new_event'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-input-gelf-2.0.7/lib/logstash/inputs/gelf.rb:113:in `udp_listener'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-input-gelf-2.0.7/lib/logstash/inputs/gelf.rb:77:in `run'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-2.3.3-java/lib/logstash/pipeline.rb:342:in `inputworker'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-2.3.3-java/lib/logstash/pipeline.rb:336:in `start_input'"],
:level=>:warn, :file=>"logstash/inputs/gelf.rb", :line=>"80", :method=>"run"}

For me this looks like Logstash is trying to dereference a null object.

The trace points to https://github.com/logstash-plugins/logstash-input-gelf/blob/v2.0.7/lib/logstash/inputs/gelf.rb#L130. This leads to the conclusion that parse(json_gelf) returned null. Should't there be some kind of check for this?

sandrinr commented 8 years ago

I just saw that this is fixed on the master branch. https://github.com/logstash-plugins/logstash-input-gelf/blob/master/lib/logstash/inputs/gelf.rb#L130

sandrinr commented 8 years ago

You guys fixed that issue in the tag 2.0.8. However, you never released that tag to RugyGems. This makes it very hard for me to fix a current stable Logstash installation (2.3.4). Could you publish the 2.0.8 release on RubyGems?

suyograo commented 8 years ago

Published

sandrinr commented 8 years ago

@suyograo Thank you very much for publishing the plugin.

However, something seems odd. When I try to execute the plugin installation it fails because of an unmet dependecy logstash-core-plugin-api (~> 2.0).

$ plugin install --version 2.0.8 --no-verify logstash-input-gelf
The use of bin/plugin is deprecated and will be removed in a feature release. Please use bin/logstash-plugin.
Installing logstash-input-gelf
Plugin version conflict, aborting
ERROR: Installation Aborted, message: Bundler could not find compatible versions for gem "logstash-core-plugin-api":
  In snapshot (Gemfile.lock):
    logstash-core-plugin-api (= 1.18.0)

  In Gemfile:
    [...]
    logstash-input-gelf (= 2.0.8) java depends on
      logstash-core-plugin-api (~> 2.0) java

    logstash-core-plugin-api (= 1.18.0) java

This seems to be in sync with the info in RubyGems: https://rubygems.org/gems/logstash-input-gelf/versions/2.0.8

However, when I look at the spec here https://github.com/logstash-plugins/logstash-input-gelf/blob/v2.0.8/logstash-input-gelf.gemspec#L23 it seems to be correct. Am I doing something wrong or is the deployed artifact for version 2.0.8 not corresponding to the code in the git tag v2.0.8?