Error while connecting Logstash to Elastic search


(Sayali) #1

I am very very new to ELK, I installed ELK version 5.6.12 on CentOS sever. Elasticsearch and Kibana works fine. But I cannot connect Logstash to Elastic search. I have set environment variable as
export JAVA_HOME=/usr/local/jdk1.8.0_131
export PATH=/usr/local/jdk1.8.0_131/bin:$PATH

I run simple test as
bin/logstash -e 'input { stdin { } } output { elasticsearch { host => localhost:9200 protocol => "http" port =>
"9200" } }'

I get following error
WARNING: Could not find logstash.yml which is typically located in
$LS_HOME/config or /etc/logstash. You can specify the path using --
path.settings. Continuing using the defaults
Could not find log4j2 configuration at path
/etc/logstash/logstash.yml/log4j2.properties. Using default config which
logs errors to the console

Simple "slash" mentioned in official documentation of Logstash works like following
$bin/logstash -e 'input { stdin { } } output { stdout {} }'
Hello
WARNING: Could not find logstash.yml which is typically located in
$LS_HOME/config or /etc/logstash. You can specify the path using --
path.settings. Continuing using the defaults Could not find log4j2
configuration at path /usr/share/logstash/config/log4j2.properties.
Using default config which logs errors to the console
The stdin plugin is now waiting for input: {
"@version" => "1",
"host" => "localhost",
"@timestamp" => 2018-11-01T04:44:58.648Z,
"message" => "Hello" }
What could be the problem?


(Alex Stiff) #2

The error is fairly clear - it says it could not find logstash.yml, and recommends specifying the path using --path.settings. Modify your command to point at the config directory:

bin/logstash -e 'input { stdin { } } output { elasticsearch { host => localhost:9200 protocol => "http" port =>
"9200" } }' --path.settings config/

(vamshi) #3

I got the same error but when I've specified the path for logstash.yml file using path.settings field, it ran as expected.

You can try following command:

bin/logstash -e 'input { stdin { } } output { elasticsearch { host => localhost:9200 protocol =>; "http" port ="9200" } }' --path.settings /etc/logstash/

Hope this works!


(system) #4

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.