3

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 {  }
}
baudsp
  • 4,076
  • 1
  • 17
  • 35
glaltv
  • 61
  • 1
  • 3

3 Answers3

4

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 %*
Ivan Yuriev
  • 488
  • 8
  • 14
0

You can try this to solved your problem as I had also the same problem and solved it.

If you are using windows, try to remove the space from path, move logstash to folder C:

Suraj Kumar
  • 5,547
  • 8
  • 20
  • 42
osama Hassan
  • 111
  • 1
  • 4
0

Use:

logstash.bat -f logstashpipline.conf

Instead of:

logstash -f logstashpipline.conf
Sorul
  • 324
  • 2
  • 12