Creating logstash development environment for core or plugins

I had to develop a ruby logstash plugin recently and I going to recap all necessary steps to create a clean jruby env for development :

  • i had to uninstall ruby and install a clean jruby only stack. Not saying that this is necessary but in my case it only worked this way
gpg --keyserver hkp:// --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
curl -sSL | bash -s stable --ruby=jruby-
rvm alias create default jruby-
source $HOME/.rvm/scripts/rvm
ruby -v
jruby (2.3.3) 2017-05-25 b09c48a OpenJDK 64-Bit Server VM 25.151-b12 on 1.8.0_151-8u151-b12-0ubuntu0.16.04.2-b12 +jit [linux-x86_64]
  • Install and compile logstash just to see if everything works. Check out logstash and from inside the directory :
jruby -S gem install rake bundler
rake bootstrap
rake plugin:install-default
bin/logstash -e 'input { stdin { } } output { stdout {} }'

  • Now compile the plugin from the plugin folder
bundle install
bundle exec rspec # test it
gem build logstash-filter-<yourplugin>.gemspec
  • Install the plugin gem and test it
bin/logstash-plugin install logstash-filter-<yourplugin>-1.0.0.gem