Using Ruby C Extensions with Logstash Ruby Plugin


I have a Ruby C extension which I've created with the following tutorial:

It works perfectly when I create the Makefile with the Ruby installed on my machine (ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu]).

After 'mkmf' creates the Makefile, I'm able to 'make' the .so file and require it with ruby installed on my machine.

But when I try to require it with the Logstash 'irb' I get the following error with a stack trace:

irb(main):001:0> require '/path/to/'
LoadError: no such file to load -- /path/to/point
        from org/jruby/ `require'
        from /usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
        from (irb):1:in `<eval>'
        from org/jruby/ `eval'
        from org/jruby/ `loop'
        from org/jruby/ `catch'
        from org/jruby/ `catch'
        from /usr/share/logstash/logstash-core/lib/logstash/runner.rb:464:in `start_shell'
        from /usr/share/logstash/logstash-core/lib/logstash/runner.rb:282:in `execute'
        from /usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/clamp-0.6.5/lib/clamp/command.rb:67:in `run'
        from /usr/share/logstash/logstash-core/lib/logstash/runner.rb:238:in `run'
        from /usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/clamp-0.6.5/lib/clamp/command.rb:132:in `run'
        from /usr/share/logstash/lib/bootstrap/environment.rb:73:in `<main>'

I also tried to start the Logstash with the '--path.plugins' but it gave me this error message:
Logstash stopped processing because of an error: (NameError) '@path.plugins' is not allowable as an instance variable name

Is it possible to require .so files with Logstash Ruby at all or can I require the C extension with some other technique?

Best Regards

Logstash uses JRuby, so I do not think that is possible.

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