Issues installing custom plugin


(Russ Lavoie) #1

I am having issues installing a custom plugin and it is driving me nuts.

Environment
Ubuntu 12.0.4 64 Bit
Installed Logstash via provided deb package (1.5.2)

Followed the link https://www.elastic.co/guide/en/logstash/1.5/_how_to_write_a_logstash_filter_plugin.html to the "T"

I needed support for memcached, json and mysql so I added the following to my logstash-filter-enrichment.gemspec and the Gemfile

gemspec
s.add_runtime_dependency "memcached" s.add_runtime_dependency "json" s.add_runtime_dependency "mysql2"

Gemfile
gem "memcached" gem "json" gem "mysql2"

I am able to build the gem with no issue.
gem build logstash-filter-enrichment.gemspec Successfully built RubyGem Name: logstash-filter-enrichment Version: 0.0.1 File: logstash-filter-enrichment-0.0.1.gem

The issue is trying to install the gem.
/opt/logstash/bin/plugin install --no-verify logstash-filter-enrichment-0.0.1.gem Installing logstash-filter-enrichment Error Bundler::InstallError, retrying 1/10 An error occurred while installing memcached (1.8.0), and Bundler cannot continue. Make sure thatgem install memcached -v '1.8.0'succeeds before bundling.
But when I try gem install memcached -v '1.8.0'It installs with no issue
gem install memcached -v '1.8.0' Building native extensions. This could take a while... Successfully installed memcached-1.8.0 1 gem installed Installing ri documentation for memcached-1.8.0... Installing RDoc documentation for memcached-1.8.0...
So I thought, well... Lets to upgrade to logstash 2.1 and see how that rolls.

Same issue, but I followed the below instead https://www.elastic.co/guide/en/logstash/current/_how_to_write_a_logstash_filter_plugin.html

So for my own testing I walked into the plugin directory and ran bundle install and it kicks back the following
bundle install Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this application for all non-root users on this machine. Updating git://github.com/elastic/logstash.git Fetching gem metadata from https://rubygems.org/........... Fetching version metadata from https://rubygems.org/... Fetching dependency metadata from https://rubygems.org/.. Could not find gem 'logstash (>= 0) ruby' in git://github.com/elastic/logstash.git (at 2.1). Source does not contain any versions of 'logstash (>= 0) ruby'

My Gemfile for my plugin has the following entry per the documentation
gem "logstash", :github => "elastic/logstash", :branch => "2.1"

That stopped me from going further.

But for kicks I commented out the logstash entries in the Gemfile and gemspec file and tried again

bundle install Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this application for all non-root users on this machine. Resolving dependencies... Using json 1.8.3 Using memcached 1.8.0 Using mysql2 0.4.2 Using logstash-filter-enrichment 0.0.1 from source at . Using bundler 1.10.6 Bundle complete! 4 Gemfile dependencies, 5 gems now installed. Usebundle show [gemname]to see where a bundled gem is installed.

Thanks for your help all :smile:


(Russ Lavoie) #2

Found the issue it seems. Since memcached and mysql2 use C based headers to install, I switched the mysql2 gem to use ruby-mysql and the memcached gem to use dalli. Looks like we are in the clear now.


(system) #3