Logstash : Error: Could not find or load main class Stack when trying to run logstash.bat

960 views Asked by At

I learning ELK Stack. I have my ElasticSearch running on port 9200. But when I am trying to stash my first event with LogStash (With the command logstash -e 'input { stdin { } } output { stdout {} }' according to docs https://www.elastic.co/guide/en/logstash/current/first-event.html ; I get this error.

Error: Could not find or load main class Stack\logstash-7.9.2\logstash-7.9.2\logstash-core\lib\jars\animal-sniffer-annotations-1.14.jar

Any idea how to fix this ?

1

There are 1 answers

0
pasindupa On

After going through some Q/A forums, I could find the solution.

Open logstash.bat with your code editor.

Replace

%JAVA% %JAVA_OPTS% -cp "%CLASSPATH%" org.logstash.Logstash %*

with

%JAVA% %JAVA_OPTS% -cp %CLASSPATH% org.logstash.Logstash %*

And save the file and retry stashing again. This solution worked for me.