Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot run logstsh on windows

I am trying to get the logs from logstash and send it to elasticsearch for visualising the logs using kibana but I am getting an error while running this code from logstash\bin directory logstash -f logstashpipline.conf The error says Error: Could not find or load main class MyPC\Desktop\logstash\logstash-core\lib\jars\animal-sniffer-annotations-1.14.jar;

java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) Client VM (build 25.161-b12, mixed mode, sharing)

This is my code:

input {
  file {
    path => "C:\xampp\apache\logs\access.log"
    type => "apache_access"
    start_position => "beginning"
  }
  file {
    path => "C:\xampp\apache\logs\error.log"
    type => "apache_error"
    start_position => "beginning"
  }
}

output {
 elasticsearch {
   hosts => "localhost:9200"

   index => "apache_logs"
   document_type => "system_logs"
 }
 stdout {  }
}
like image 387
glaltv Avatar asked Feb 03 '26 17:02

glaltv


1 Answers

this is the problem of 6.4.1 version of logstash.bat: redundant quotes are applied for %CLASSPATH% So, you can fix it manually by editing logstash.bat file. Find and replace this line

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

with that one

%JAVA% %JAVA_OPTS% -cp %CLASSPATH% org.logstash.Logstash %*
like image 107
Ivan Yuriev Avatar answered Feb 06 '26 12:02

Ivan Yuriev



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!