NoMethodError: undefined method `<' for nil:NilClass>

The config for my logstash looks like:

input {
      kafka {
        bootstrap_servers => "kafka-0.kafka-svc.ns-adutta.svc.cluster.local:9093,kafka-1.kafka-svc.ns-adutta.svc.cluster.local:9093,kafka-2.kafka-svc.ns-adutta.svc.cluster.local:9093"
        topics => "ops.docker-logs-fluentbit.stream.json.001"
        group_id => "1"
        client_id => "1"
      }
    }
output {

    stdout {}
    elasticsearch{

      hosts => "https://abcd.com:9243"
      index => "docker-logs"
      user => "xx"
      password => "xxxx"

  }

The error I get:
[2018-05-30T11:58:45,130][FATAL][logstash.runner ] An unexpected error occurred! {:error=>#<NoMethodError: undefined method <' for nil:NilClass>, :backtrace=>["/usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-output-elasticsearch-9.1.1-java/lib/logstash/outputs/elasticsearch/common.rb:222:inget_event_type'", "/usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-output-elasticsearch-9.1.1-java/lib/logstash/outputs/elasticsearch/common.rb:47:in event_action_tuple'", "/usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-output-elasticsearch-9.1.1-java/lib/logstash/outputs/elasticsearch/common.rb:36:inblock in multi_receive'", "org/jruby/RubyArray.java:2486:in map'", "/usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-output-elasticsearch-9.1.1-java/lib/logstash/outputs/elasticsearch/common.rb:36:inmulti_receive'", "/usr/share/logstash/logstash-core/lib/logstash/output_delegator_strategies/shared.rb:13:in multi_receive'", "/usr/share/logstash/logstash-core/lib/logstash/output_delegator.rb:49:inmulti_receive'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:477:in block in output_batch'", "org/jruby/RubyHash.java:1343:ineach'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:476:in output_batch'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:428:inworker_loop'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:386:in `block in start_workers'"]}
[2018-05-30T11:58:45,302][ERROR][org.logstash.Logstash ] java.lang.IllegalStateException: org.jruby.exceptions.RaiseException: (SystemExit) exit

The stdout works fine as it prints the kafka messages, but the elasticsearch doesn't receive any. Please help.

@Akash_Kumar_Dutta

This error typically occurs when the elasticsearch instance is not available when Logstash starts up. Make sure that you can access the elasticsearch instance from the machine that Logstash is running on.

The latest version of the elasticsearch output plugin handles this a little better - it will wait for connectivity to the elasticsearch box, rather than producing this error. To update the plugin, run

bin/logstash-plugin update logstash-output-elasticsearch

Thanks,

Rob

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.