Run Logstash with local ruby2.4

Hi,

I am a newbie in-terms of Ruby.

I am trying to extend the ruby-filewatch library used by the logstash-input-file plugin.

For the extension I'm using the external lib - rest-client. This external lib requires ruby 2.0 or above to run successfully.

I have made my changes in ruby-filewatch and done

gem build filewatch.gemspec
gem install filewatch-0.9.0.gem

This installs the generated lib filewatch-0.9.0 under my ~/.rvm/gems/ruby-2.4.0/gems folder.

However, whenever I run logstash with - logstash -f [CONF_PATH] it looks for the required libs for it input plugins inside [LOGSTASH_HOME]/vendor/bundle/jruby/1.9/gems

So I copied the generated filewatch-0.9.0 folder into the above path.

But still I get the following error:

LoadError: no such file to load -- rest-client
       require at org/jruby/RubyKernel.java:1040
       require at [PATH]/logstash-5.3.0/vendor/bundle/jruby/1.9/gems/polyglot-0.3.5/lib/polyglot.rb:65
        (root) at [PATH]/logstash-5.3.0/vendor/bundle/jruby/1.9/gems/filewatch-0.9.0/lib/filewatch/observing_tail.rb:2

observing_tail.rb:2 has this code :

require 'rest-client'

Can someone help me get through this issue??

Logstash cannot run with Ruby. It now has many components written in native Java, so it can only run with JRuby.

Okay. I am NOT very familiar with the differences of JRuby and Ruby.

Can you help achieve what I am trying to do?

I have the default logstash-input-file plugin. I want to make a modification to the filewatcher library this plugin uses. The modification includes making a REST call and getting a response.
For this purpose, I tried to use rest-client library.

If this is not the right one, then what's the right way to do it?

Thank You

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.