Logstash - install & first test

Hi,

I try to install and test logstash according to the following tutorial.

https://www.elastic.co/guide/en/logstash/current/first-event.html

I have the following error.

java -version

java version "1.8.0_31"
Java(TM) SE Runtime Environment (build 1.8.0_31-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)

or

java version "1.7.0_75"
Java(TM) SE Runtime Environment (build 1.7.0_75-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.75-b04, mixed mode)

cd logstash-1.5.4

.\bin\logstash -e 'input { stdin { } } output { stdout {} }'

Erreur : impossible de trouver ou charger la classe principale org.jruby.Main

Could you help to understand the problem and solve it ?

Best regards,

Franck

Is that a typo, it should be stdin.

No it's not the problem because I tested with stdin instead of stdi.

I think the problem is jruby because I can't get version of jruby.

D:\bin\logstash-1.5.4>.\vendor\jruby\bin\jruby -v
Erreur : impossible de trouver ou charger la classe principale org.jruby.Main

Shouldn't matter as LS only needs java installed.

I find the solution of this problem.

set SCRIPT_DIR=%~dp0
set JRUBY_HOME=%SCRIPT_DIR%\logstash-1.5.4\vendor\jruby
logstash-1.5.4\bin\logstash -e 'input { stdin { } } output { stdout {} }'

Where did you set those variables?

Forget my question, I see you set them just before starting logstash on the command line :frowning:

What's the full path to the Logstash binary?

There has been issues in the past when directory names have spaces in them.

I installed elasticsearch, logstash and kibana in the following directories.
Then, I created 2 files :

  • logstash.cong, logstash configuration file
  • start.bat, a bat file who start elasticsearch, logbash and kibana

I think ELK could be started like services but i dont't test this method for the moment.

D:\bin\elk\elasticsearch-1.7.2
D:\bin\elk\logstash-1.5.4
D:\bin\elk\kibana-4.1.2-windows
D:\bin\elk\logstash.conf

input {
stdin { }
}
output {
elasticsearch {
host => localhost
}
}

D:\bin\elk\start.bat
@echo off

set SCRIPT_DIR=%~dp0
set JRUBY_HOME=%SCRIPT_DIR%\logstash-1.5.4\vendor\jruby

start elasticsearch-1.7.2\bin\elasticsearch.bat
SLEEP 10

REM logstash-1.5.4\bin\logstash -e 'input { stdin { } } output { stdout {} }'
start logstash-1.5.4\bin\logstash -f logstash.conf
SLEEP 10

start kibana-4.1.2-windows\bin\kibana.bat
SLEEP 10

You are in the wrong folder ... that's why you have to set the JRUBY_HOME

Since you are working under Windows you have to use the bat file

cd D:\bin\elk\logstash-1.5.4
bin\logstash.bat --e 'input { stdin { } } output { stdout { codec => "rubydebug" } }'

No, I had the same problem with

cd D:\bin\elk\logstash-1.5.4
\bin\logstash -e 'input { stdin { } } output { stdout {} }'

And I solved it with

cd D:\bin\elk\logstash-1.5.4
set JRUBY_HOME=D:\bin\elk\logstash-1.5.4\vendor\jruby
\bin\logstash -e 'input { stdin { } } output { stdout {} }'

I created then a directory elk in order to group the directories elastisearch, logstash and kibana.
The file start.file is just a script to start quickly the 3 applications.