logstash-plugins / logstash-filter-grok

Grok plugin to parse unstructured (log) data into something structured.
https://www.elastic.co/guide/en/logstash/current/plugins-filters-grok.html
Apache License 2.0
124 stars 97 forks source link

tests fail because LogStash::Environment.pattern_path is not in logstash-core #72

Open jsvd opened 8 years ago

jsvd commented 8 years ago

running the specs fail for logstash-core >= 2.2

/tmp/logstash-filter-grok (git)-[master] % bundle exec rspec
Using Accessor#strict_set for specs
NoMethodError: undefined method `pattern_path' for LogStash::Environment:Module
             Grok at /private/tmp/logstash-filter-grok/lib/logstash/filters/grok.rb:226
           (root) at /private/tmp/logstash-filter-grok/lib/logstash/filters/grok.rb:139
          require at org/jruby/RubyKernel.java:1040
          require at /Users/joaoduarte/.rvm/gems/jruby-1.7.23/gems/polyglot-0.3.5/lib/polyglot.rb:65
           (root) at /private/tmp/logstash-filter-grok/spec/filters/grok_spec.rb:1
             load at org/jruby/RubyKernel.java:1059
           (root) at /private/tmp/logstash-filter-grok/spec/filters/grok_spec.rb:11
             each at org/jruby/RubyArray.java:1613
           (root) at /Users/joaoduarte/.rvm/gems/jruby-1.7.23/gems/rspec-core-3.1.7/lib/rspec/core/configuration.rb:1
  load_spec_files at /Users/joaoduarte/.rvm/gems/jruby-1.7.23/gems/rspec-core-3.1.7/lib/rspec/core/configuration.rb:1105
  load_spec_files at /Users/joaoduarte/.rvm/gems/jruby-1.7.23/gems/rspec-core-3.1.7/lib/rspec/core/configuration.rb:1105
            setup at /Users/joaoduarte/.rvm/gems/jruby-1.7.23/gems/rspec-core-3.1.7/lib/rspec/core/runner.rb:96
              run at /Users/joaoduarte/.rvm/gems/jruby-1.7.23/gems/rspec-core-3.1.7/lib/rspec/core/runner.rb:84
              run at /Users/joaoduarte/.rvm/gems/jruby-1.7.23/gems/rspec-core-3.1.7/lib/rspec/core/runner.rb:69
             load at org/jruby/RubyKernel.java:1059
           invoke at /Users/joaoduarte/.rvm/gems/jruby-1.7.23/gems/rspec-core-3.1.7/lib/rspec/core/runner.rb:37
             eval at org/jruby/RubyKernel.java:1079
           (root) at /Users/joaoduarte/.rvm/gems/jruby-1.7.23/bin/jruby_executable_hooks:15

this happens because LogStash::Environment.pattern_path is not defined in logstash-core gem but instead in the boostrapping code

carlphilipp commented 8 years ago

I have the same issue

elyscape commented 8 years ago

This continues to be an issue for plugins that depend on logstash-filter-grok because, while v2.0.4 has the fix, v2.0.4 was never pushed to RubyGems.

colinsurprenant commented 8 years ago

Just had this discussion with @elyscape on IRC about this: here's my assessment:

colinsurprenant: Elyscape: yeah, ok, I get it now… - outside the context of running logstash, pattern_path is underfined because it’s only part of the bootstrap. but pattern_path is only defined in the grok specs to have the test pass outside the logstash context but any other plugins depending on grok which covers the grok usage will also fail because pattern_parth is still undefined. [4:41pm]

so yeah, we need to either re-relocate pattern_path or having it correctly exposed to that any downstream plugins that depend on grok can run their specs which uses grok.

colinsurprenant commented 8 years ago

forgot to also add @markwalkom

colinsurprenant commented 8 years ago

I opened elastic/logstash#4928 for this