Logstash - install & first test


(Franck Sérot) #1

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


(Mark Walkom) #2

Is that a typo, it should be stdin.


(Franck Sérot) #3

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


(Franck Sérot) #4

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


(Mark Walkom) #5

Shouldn't matter as LS only needs java installed.


(Franck Sérot) #6

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 {} }'


#7

Where did you set those variables?


#8

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


(Mark Walkom) #9

What's the full path to the Logstash binary?

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


(Franck Sérot) #10

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


(Tan Vinh Nguyen) #11

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" } }'

(Franck Sérot) #12

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.


(system) #13