Question

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 :

  • I installed rvm environement (as a side note, the standard install scripts create a new .bash_profile, which disable the standard .bashrc script when you're on Ubuntu. This can confuse new users like me... I was wondering for several hours why my 'll' alias won't work !)
  • I uncompressed logstash (jar xvf /logstash-1.1.4-monolithic.jar) in a new directory
  • I've followed the instructions in https://rvm.io/rvm/install/ as rvm install 1.9.2 (albeit I've also made some try/error/redo manipulations, so I can't remember the exact listing of commands)

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...

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top