logstash-plugins/logstash-input-beats

Failed to build the project

tsaarni opened this issue · 3 comments

I would like to work on the code of logstash-input-beats. I tried to run through the instructions in README.md but immediately bumped into some problems:

When I run bundle install I get following dependency error:

Bundler could not find compatible versions for gem "concurrent-ruby":
  In Gemfile:
    logstash-input-beats was resolved to 6.2.6, which depends on
logstash-core-plugin-api (>= 1.60, <= 2.99) was resolved to 1.60.1, which
depends on
logstash-core (<= 2.4.99, >= 2.4.0.snapshot1) was resolved to 2.4.1,
which depends on
          concurrent-ruby (= 0.9.2)

    logstash-input-beats was resolved to 6.2.6, which depends on
      concurrent-ruby (~> 1.0)

It seems bundler resolves to old logstash-core-plugin-api version for some reason? If I hardcode the version of logstash-core-plugin-api to latest 2.1.28 then I get error

Bundler could not find compatible versions for gem "logstash-core":
  In Gemfile:
    logstash-input-beats was resolved to 6.2.6, which depends on
logstash-core-plugin-api (= 2.1.28) was resolved to 2.1.28, which depends
on
        logstash-core (= 5.6.4)

    logstash-input-beats was resolved to 6.2.6, which depends on
logstash-mixin-ecs_compatibility_support (~> 1.3) was resolved to 1.3.0,
which depends on
        logstash-core (>= 6.0.0)

I think I must be doing something completely wrong. I realize that the README.md is a copy from logstash-output-example and maybe not up to date for this particular plugin. I wonder if you could help me on the right direction. How can I build a gem for this plugin with compiled jars inside?

Thank you for your help!

Information about environment:

  • jruby-9.3.3.0 (under rbenv)
  • Bundler version 2.2.29
  • Gem version 3.2.29
  • Updating gem and bundler gem update --system did not help
  • This is fresh git checkout of the code, e.g. there is no Gemfile.lock

I seems that these two changes let me work around the above failure

diff --git a/logstash-input-beats.gemspec b/logstash-input-beats.gemspec
index d6a0ba9..5d8c25a 100644
--- a/logstash-input-beats.gemspec
+++ b/logstash-input-beats.gemspec
@@ -27,8 +27,7 @@ Gem::Specification.new do |s|
   s.add_runtime_dependency "thread_safe", "~> 0.3.5"
   s.add_runtime_dependency "logstash-codec-multiline", ">= 2.0.5"
   s.add_runtime_dependency 'jar-dependencies', '~> 0.3', '>= 0.3.4'
-  s.add_runtime_dependency 'logstash-mixin-ecs_compatibility_support', '~>1.3'
-  s.add_runtime_dependency 'logstash-mixin-event_support', '~>1.0'
+  s.add_runtime_dependency 'logstash-mixin-ecs_compatibility_support', '~>1.0'
 
   s.add_development_dependency "flores", "~>0.0.6"
   s.add_development_dependency "rspec"

Obviously these dependencies were added for a reason so the package would not work correctly after these changes, but at least it lets me proceed with the build (I can run rake vendor and gem build logstash-input-beats.gemspec successfully).

@kares Would you have any insights in this, what could be wrong?

kares commented

Those README's are often fairly generic and need updating, these days the assumption for a

  • LOGSTASH_PATH env pointing to a LS installation (or LS built from source)
  • LOGSTASH_SOURCE=1

https://github.com/logstash-plugins/logstash-input-beats/blob/main/Gemfile#L5-L11 is pretty much required.

Also, try matching the local JRuby version with the one embedded in LS, latest 9.2.x will do - with 9.3 you might run into other incompatibilities.

Perfect! Thank you @kares, could not have figured out myself :)