Logstash : "Error: Could not find or load main class Heal" when running logstash.bat

Viewed 1268

I just downloaded logstash 7.6.0 in windows 10. I already have elastic search (7.6.0) and kibana (7.6.0) running. When I run logstash.bat with default configuration it gives this error.

Error: Could not find or load main class Heal

I have jdk 11 installed and I checked that the environment variable is set. Please help.

EDIT: Added config file

input{
    file =>"D://logfile-2020-03-22.log"
    start_position => "beginning"
    type => "json"
}

output{
    elasticsearch {
        hosts => ["localhost:9200"]
    }
}

Actually this same configuration is working fine on one of our servers. But when I am trying to set it up locally it is giving this error. The only differences I can find is the OS (Windows server 2012 r2 vs windows 10) and the version of ELK stack (7.6.1 on server and 7.6.0 locally)

3 Answers

Remember that you mustn't run logstash from a folder that contains space in the name (like "Program Files"). Move it to "C:\myFolderNameWithoutWhitespace".

It looks like the issue was with my Java installation, I uninstalled my java (java 8) and downloaded java version 11 and it solved the issue.

You have to create a new configuration file for logstash to output to Elasticsearch. Give it any name like first-pipeline.conf and paste below content.

# The # character at the beginning of a line indicates a comment. Use 
# comments to describe your configuration.
input {
 #standard input
 stdin { }
 #filebeat input
 # beats {
 #    port => "5044"
 #}
}
# The filter part of this file is commented out to indicate that it is
# optional.
# filter {
#
# }
output {
  elasticsearch {
    hosts => [ "localhost:9200" ]
  }
}

Now from the commandline run the below command

bin>logstash -f first-pipeline.conf
Related