elastic / logstash

Logstash - transport and process your logs, events, or other data
https://www.elastic.co/products/logstash
Other
14.18k stars 3.49k forks source link

Customer plugin install failed in 6.2.1 #9163

Closed kai-kzh closed 6 years ago

kai-kzh commented 6 years ago

FROM docker.elastic.co/logstash/logstash:6.2.1 COPY plugin/logstash-filter-patternkv-0.1.0.gem /tmp/ RUN /usr/share/logstash/bin/logstash-plugin install /tmp/logstash-filter-patternkv-0.1.0.gem

config/logstash.yml:

http.host: "0.0.0.0" path.config: /usr/share/logstash/pipeline pipeline.workers: 5 xpack.monitoring.enabled: false

Building logstash Step 1/3 : FROM docker.elastic.co/logstash/logstash:6.2.1 ---> 273855ab6e89 Step 2/3 : COPY plugin/logstash-filter-patternkv-0.1.0.gem /tmp/ ---> Using cache ---> 0b0e5767d573 Step 3/3 : RUN /usr/share/logstash/bin/logstash-plugin install /tmp/logstash-filter-patternkv-0.1.0.gem ---> Running in cba045223544 Validating /tmp/logstash-filter-patternkv-0.1.0.gem Installing logstash-filter-patternkv Error NoMethodError, retrying 1/10 undefined method source_uri' for nil:NilClass Error NoMethodError, retrying 2/10 undefined methodsource_uri' for nil:NilClass Error NoMethodError, retrying 3/10 undefined method source_uri' for nil:NilClass Error NoMethodError, retrying 4/10 undefined methodsource_uri' for nil:NilClass Error NoMethodError, retrying 5/10 undefined method source_uri' for nil:NilClass Error NoMethodError, retrying 6/10 undefined methodsource_uri' for nil:NilClass Error NoMethodError, retrying 7/10 undefined method source_uri' for nil:NilClass Error NoMethodError, retrying 8/10 undefined methodsource_uri' for nil:NilClass Error NoMethodError, retrying 9/10 undefined method source_uri' for nil:NilClass Error NoMethodError, retrying 10/10 undefined methodsource_uri' for nil:NilClass Too many retries, aborting, caused by NoMethodError ERROR: Installation Aborted, message: undefined method `source_uri' for nil:NilClass ERROR: Service 'logstash' failed to build: The command '/bin/sh -c /usr/share/logstash/bin/logstash-plugin install /tmp/logstash-filter-patternkv-0.1.0.gem' returned a non-zero code: 1

But it get passed in 6.1.1:

Building logstash Step 1/3 : FROM docker.elastic.co/logstash/logstash:6.1.1 ---> 43c682749a7f Step 2/3 : COPY plugin/logstash-filter-patternkv-0.1.0.gem /tmp/ ---> 3816a9e2531c Step 3/3 : RUN /usr/share/logstash/bin/logstash-plugin install /tmp/logstash-filter-patternkv-0.1.0.gem ---> Running in cd077a865650 Validating /tmp/logstash-filter-patternkv-0.1.0.gem Installing logstash-filter-patternkv Installation successful ---> 7eb8068581d7 Removing intermediate container cd077a865650 Successfully built 7eb8068581d7 Successfully tagged elkcompose_logstash:latest

While method "source_uri" is not used in this plugin.

Thank you for your attention.

nick-george commented 6 years ago

I'm experiencing the same issue using the logstash RPM v6.2.1 release (not using Docker) on OL7.

algestam commented 6 years ago

Same problem experienced here when installing locally developed plugins on both 6.2.0 and 6.2.1. The latest Logstash version where this works for me is 6.1.3. My setup is docker based on Ubuntu 16.04.

jordansissel commented 6 years ago

I’ve seen similar errors happen when there is a proxy setting that is incorrect or misunderstood by Logstash.

If you are experiencing this, Please share your full configuration including any config files and environment variables.

On Tue, Feb 20, 2018 at 12:34 AM algestam notifications@github.com wrote:

Same problem experienced here when installing locally developed plugins on both 6.2.0 and 6.2.1. The latest Logstash version where this works for me is 6.1.3. My setup is docker based on Ubuntu 16.04.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/elastic/logstash/issues/9163#issuecomment-366903528, or mute the thread https://github.com/notifications/unsubscribe-auth/AAIC6n-ZrKUY7gFbWDtEluwBdepSKBi8ks5tWoOrgaJpZM4SJBTj .

lasitha1991 commented 6 years ago

Hi,

I'm also facing this issue with logstash version 6.2.1 when I try to install a custom filter plugin.

OS: Windows 7

Same gem file get successfully installed in logstash version 6.1.3

algestam commented 6 years ago

Did a bit of experimentation and here are some findings but I still haven't found what's causing the problem.

The same problems happens with both JRuby 1.7.25 and 9.1.15.0.

Changing the line in the Dockerfile that installs the plugin to enable debugging gives the following stacktrace when the plugin installation fails (using Logstash 6.2.0):

.
.
.
HTTP 200 OK
Query List: []
  * addressable-2.3.8.gem
  * cabin-0.9.0.gem
  * arr-pm-0.0.10.gem
  * atomic-1.1.99-java.gem
  * avl_tree-1.2.1.gem
  * awesome_print-1.8.0.gem
  * jmespath-1.3.1.gem
  * aws-sdk-core-2.3.22.gem
  * aws-sdk-resources-2.3.22.gem
  * aws-sdk-2.3.22.gem
  * json-1.8.6-java.gem
  * nokogiri-1.8.2-java.gem
  * aws-sdk-v1-1.67.0.gem
  * backports-3.11.1.gem
  * bindata-2.4.1.gem
  * buftok-0.2.0.gem
  * builder-3.2.3.gem
  * ffi-1.9.18-java.gem
  * childprocess-0.8.0.gem
  * numerizer-0.1.1.gem
  * chronic_duration-0.10.6.gem
  * clamp-0.6.5.gem
  * coderay-1.1.2.gem
  * concurrent-ruby-1.0.5-java.gem
  * unf-0.1.4-java.gem
  * domain_name-0.5.20170404.gem
  * dotenv-2.2.1.gem
  * edn-1.1.1.gem
  * multi_json-1.13.1.gem
  * elasticsearch-api-5.0.4.gem
  * multipart-post-2.0.0.gem
  * faraday-0.9.2.gem
  * elasticsearch-transport-5.0.4.gem
  * elasticsearch-5.0.4.gem
  * equalizer-0.0.10.gem
  * filesize-0.0.4.gem
  * filewatch-0.9.0.gem
  * fpm-1.3.3.gem
  * gelfd-0.2.0.gem
  * gems-0.8.3.gem
  * hitimes-1.2.6-java.gem
  * http-cookie-1.0.3.gem
  * http-form_data-1.0.1.gem
  * http_parser.rb-0.6.0-java.gem
  * http-0.9.9.gem
  * i18n-0.6.9.gem
  * insist-1.0.0.gem
  * jar-dependencies-0.3.12.gem
  * jls-grok-0.11.4.gem
  * jls-lumberjack-0.0.26.gem
  * jrjackson-0.4.4-java.gem
  * jruby-openssl-0.9.21-java.gem
  * jruby-stdin-channel-0.2.0-java.gem
  * manticore-0.6.1-java.gem
  * minitar-0.6.1.gem
  * method_source-0.8.2.gem
  * slop-3.6.0.gem
  * spoon-0.0.6.gem
  * pry-0.10.4-java.gem
  * puma-2.16.0-java.gem
  * rack-1.6.6.gem
  * rubyzip-1.2.1.gem
  * rack-protection-1.5.3.gem
  * tilt-2.0.8.gem
  * sinatra-1.4.8.gem
  * stud-0.0.23.gem
  * thread_safe-0.3.6-java.gem
  * polyglot-0.3.5.gem
  * treetop-1.4.15.gem
  * logstash-codec-cef-5.0.2-java.gem
  * logstash-codec-collectd-3.0.8.gem
  * logstash-codec-dots-3.0.6.gem
  * logstash-codec-edn-3.0.6.gem
  * logstash-codec-line-3.0.8.gem
  * logstash-codec-edn_lines-3.0.6.gem
  * logstash-codec-es_bulk-3.0.6.gem
  * msgpack-1.2.2-java.gem
  * logstash-codec-fluent-3.1.5-java.gem
  * logstash-codec-graphite-3.0.5.gem
  * logstash-codec-json-3.0.5.gem
  * logstash-codec-json_lines-3.0.5.gem
  * logstash-codec-msgpack-3.0.7-java.gem
  * logstash-patterns-core-4.1.2.gem
  * logstash-codec-multiline-3.0.9.gem
  * logstash-codec-netflow-3.10.0.gem
  * logstash-codec-plain-3.0.6.gem
  * logstash-codec-rubydebug-3.0.5.gem
  * logstash-filter-aggregate-2.7.2.gem
  * murmurhash3-0.1.6-java.gem
  * logstash-filter-anonymize-3.0.6.gem
  * logstash-filter-cidr-3.1.2-java.gem
  * logstash-filter-clone-3.0.5.gem
  * logstash-filter-csv-3.0.8.gem
  * logstash-filter-date-3.1.9.gem
  * logstash-filter-dateparts-2.2-java.gem
  * logstash-filter-de_dot-1.0.3.gem
NoMethodError: undefined method `source_uri' for nil:NilClass
            fetch_gem at /logstash/vendor/bundle/jruby/2.3.0/gems/bundler-1.9.10/lib/bundler/source/rubygems.rb:367
  cached_built_in_gem at /logstash/vendor/bundle/jruby/2.3.0/gems/bundler-1.9.10/lib/bundler/source/rubygems.rb:170
           cached_gem at /logstash/lib/bootstrap/bundler.rb:31
                cache at /logstash/vendor/bundle/jruby/2.3.0/gems/bundler-1.9.10/lib/bundler/source/rubygems.rb:155
       block in cache at /logstash/vendor/bundle/jruby/2.3.0/gems/bundler-1.9.10/lib/bundler/runtime.rb:113
                 each at org/jruby/RubyArray.java:1734
                 each at /logstash/vendor/jruby/lib/ruby/stdlib/forwardable.rb:189
                cache at /logstash/vendor/bundle/jruby/2.3.0/gems/bundler-1.9.10/lib/bundler/runtime.rb:110
                  run at /logstash/vendor/bundle/jruby/2.3.0/gems/bundler-1.9.10/lib/bundler/cli/install.rb:81
              install at /logstash/vendor/bundle/jruby/2.3.0/gems/bundler-1.9.10/lib/bundler/cli.rb:155
                  run at /logstash/vendor/bundle/jruby/2.3.0/gems/bundler-1.9.10/lib/bundler/vendor/thor/lib/thor/command.rb:27
       invoke_command at /logstash/vendor/bundle/jruby/2.3.0/gems/bundler-1.9.10/lib/bundler/vendor/thor/lib/thor/invocation.rb:126
             dispatch at /logstash/vendor/bundle/jruby/2.3.0/gems/bundler-1.9.10/lib/bundler/vendor/thor/lib/thor.rb:359
                start at /logstash/vendor/bundle/jruby/2.3.0/gems/bundler-1.9.10/lib/bundler/vendor/thor/lib/thor/base.rb:440
                start at /logstash/vendor/bundle/jruby/2.3.0/gems/bundler-1.9.10/lib/bundler/cli.rb:10
      execute_bundler at /logstash/lib/bootstrap/bundler.rb:155
              invoke! at /logstash/lib/bootstrap/bundler.rb:116
   install_gems_list! at /logstash/lib/pluginmanager/install.rb:141
              execute at /logstash/lib/pluginmanager/install.rb:60
                  run at /logstash/vendor/bundle/jruby/2.3.0/gems/clamp-0.6.5/lib/clamp/command.rb:67
              execute at /logstash/vendor/bundle/jruby/2.3.0/gems/clamp-0.6.5/lib/clamp/subcommand/execution.rb:11
                  run at /logstash/vendor/bundle/jruby/2.3.0/gems/clamp-0.6.5/lib/clamp/command.rb:67
                  run at /logstash/vendor/bundle/jruby/2.3.0/gems/clamp-0.6.5/lib/clamp/command.rb:132
               <main> at /logstash/lib/pluginmanager/main.rb:48
ERROR: Service 'logstash' failed to build: The command '/bin/bash -c DEBUG=1 /logstash/bin/logstash-plugin install /logstash/share/plugins_src/logstash-filter-metalookup/logstash-filter-metalookup-*.gem' returned a non-zero code: 1

When modifying the Dockerfile to not install our custom plugins and later running logstash-plugin list --installed --verbose this is the diff of plugins that is installed for Logstash 6.1.3 and Logstash 6.2.0:

25c25
< logstash-filter-dissect (1.1.2)
---
> logstash-filter-dissect (1.1.3)
31c31,32
< logstash-filter-grok (4.0.1)
---
> logstash-filter-grok (4.0.2)
> logstash-filter-jdbc_static (1.0.0)
81c82
< logstash-output-kafka (7.0.7)
---
> logstash-output-kafka (7.0.8) 

Looking at the list of plugins it seems like that the plugin logstash-filter-dissect (1.1.3) is the next to be installed when the exception is thrown. My bundler-fu isn't strong enough though to dig deeper into this :)

Let me know if there is any other info you need from me. Unfortunately I cannot provide our plugin source but as this seems to be reproducible by others I don't think that the problem is with the custom plugin.

kai-kzh commented 6 years ago

@jordansissel Updated my logstash config file

jordansissel commented 6 years ago

I tested with 6.2.0 and a locally built plugin:

% bin/logstash-plugin install /home/jls/projects/logstash-input-tcp/logstash-input-tcp-5.0.3-java.gem
Validating /home/jls/projects/logstash-input-tcp/logstash-input-tcp-5.0.3-java.gem
Installing logstash-input-tcp
Installation successful

It works for me.

@kai-kzh I cannot test your Dockerfile because I don't have the file referenced here:

 COPY plugin/logstash-filter-patternkv-0.1.0.gem /tmp/
kai-kzh commented 6 years ago

@jordansissel Sorry I can not provide my gem file without permission. Can you try my dockerfile with your gem?

jordansissel commented 6 years ago

Ahh, I can reproduce this in Logstash 6.2.1 but not 6.2.0 without Docker.

jordansissel commented 6 years ago

Logstash 6.2.2 seems unaffected -- only 6.2.1.

I recommend you upgrade to 6.2.2.

jordansissel commented 6 years ago
⓿ pork(~/build/logstash-6.2.2)
% bin/logstash-plugin install /home/jls/projects/logstash-input-tcp/logstash-input-tcp-5.0.3-java.gem
Validating /home/jls/projects/logstash-input-tcp/logstash-input-tcp-5.0.3-java.gem
Installing logstash-input-tcp
Installation successful
kai-kzh commented 6 years ago

@jordansissel Thank you for your help! My environment also works with 6.2.2

nick-george commented 6 years ago

Confirm it's working for me too now. Thanks @jordansissel .