Bug: Logstash grok with empty match is impossible to debug

Hey,
our Logstash pipeline config files are generated. There was a bug in our generation system which led to following grog pattern. The pattern was one of MANY patterns and contained override and other clauses as well, so it was not easy to notice the empty match pattern.

filter {
  grok {
    match => [ "", "" ]
  }
}

On older versions (2.4 or so) it worked. After update, on Logstash v5.6.3 it throws following exception. The exception doesn't say what is wrong or where in the config file we did the mistake.

LogStash::Instrument::MetricNoKeyProvided: LogStash::Instrument::MetricNoKeyProvided
     validate_key! at /home/kub1x/test/logstash-5.6.3/logstash-core/lib/logstash/instrument/metric.rb:74
             gauge at /home/kub1x/test/logstash-5.6.3/logstash-core/lib/logstash/instrument/metric.rb:31
             gauge at /home/kub1x/test/logstash-5.6.3/logstash-core/lib/logstash/instrument/namespaced_metric.rb:32
          register at /home/kub1x/test/logstash-5.6.3/vendor/bundle/jruby/1.9/gems/logstash-filter-grok-3.4.3/lib/logstash/filters/grok.rb:277
              each at org/jruby/RubyHash.java:1342
          register at /home/kub1x/test/logstash-5.6.3/vendor/bundle/jruby/1.9/gems/logstash-filter-grok-3.4.3/lib/logstash/filters/grok.rb:275
          register at /home/kub1x/test/logstash-5.6.3/vendor/jruby/lib/ruby/1.9/forwardable.rb:201
   register_plugin at /home/kub1x/test/logstash-5.6.3/logstash-core/lib/logstash/pipeline.rb:290
  register_plugins at /home/kub1x/test/logstash-5.6.3/logstash-core/lib/logstash/pipeline.rb:301
              each at org/jruby/RubyArray.java:1613
  register_plugins at /home/kub1x/test/logstash-5.6.3/logstash-core/lib/logstash/pipeline.rb:301
     start_workers at /home/kub1x/test/logstash-5.6.3/logstash-core/lib/logstash/pipeline.rb:311
               run at /home/kub1x/test/logstash-5.6.3/logstash-core/lib/logstash/pipeline.rb:235
    start_pipeline at /home/kub1x/test/logstash-5.6.3/logstash-core/lib/logstash/agent.rb:398

This is a bug in Logstash grok filter as it should write a valuable message with a line number instead of just throwing an exception.

Yes, I agree. I suggest you file a GitHub issue: https://github.com/logstash-plugins/logstash-filter-grok/issues/new

1 Like

Thanks. The wheels are turning :wink:

Link for reference:

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