Orabîg
Orabîg

Reputation: 11992

How to run logstash from exploded jar with JRuby

I'm not very comfortable with jruby and rvm environments, so I have trouble trying to run logstash with it (it is said to be the fastest way to do so).

What I've tryed :

Then I tried several commands, but none of them worked :

$ ruby logstash.rb
/home/orabig/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such     file -- logstash/agent (LoadError)
    from /home/orabig/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from logstash.rb:1:in `<main>'

whereas the following line is returning after some seconds :

jruby-1.7.0 logstash.rb agent -f ../etc/inout.config -v

(the inout.config file is working when invoked with the java commandline as in :)

java -jar (...)/logstash-1.1.4-monolithic.jar agent -f ../etc/inout.config -v

So I'm basically stuck now, because the more I will try random things, the more I'm afraid to mess up my configuration...

Update : On the logstash page (https://github.com/logstash/logstash), it looks like it's working with 1.6.8 ruby version (however it's not clear, and I'm not sure if it makes any difference...) So I also tried :

  $ rvm install 1.6.8
  (...)
  $ rvm use 1.6.8
  $ export JRUBY_OPTS=--1.9
  $ ruby logstash.rb agent -f ../etc/inout.config -v
  $ jruby-1.6.8 logstash.rb agent -f ../etc/inout.config -v

but nothing happens when I run either of the last two lines...

Upvotes: 1

Views: 1765

Answers (1)

Oerd
Oerd

Reputation: 2303

As the rvm tool will let you know: You have to be in a login shell to use rvm like that.

So, either run bash -login or use rvm to select and run your version of ruby like done in the following:

rvm install 1.7.0 # note that 1.7.0 will also work
export JRUBY_OPTS=--1.9
rvm 1.7.0 do bundle install
rvm 1.7.0 do ruby lib/logstash/runner.rb agent -f ../etc/inout.config -v

This will tell rvm to use jruby-1.7.0 to run your logstash agent.

Upvotes: 1

Related Questions