# Error while connecting Logstash to Elastic search

**URL:** <https://discuss.elastic.co/t/error-while-connecting-logstash-to-elastic-search/154965>\
**Category:** Logstash\
**Created:** [November 1, 2018, 6:44am UTC](https://discuss.elastic.co/t/error-while-connecting-logstash-to-elastic-search/154965 "2018-11-01T06:44:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![saya](https://avatars.discourse-cdn.com/v4/letter/s/278dde/32.png) [@saya](https://discuss.elastic.co/u/saya)\
**Post date:** [November 1, 2018, 6:44am UTC](https://discuss.elastic.co/t/error-while-connecting-logstash-to-elastic-search/154965/1 "2018-11-01T06:44:43Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![\_Alex](https://avatars.discourse-cdn.com/v4/letter/_/54ee81/32.png) [@\_Alex](https://discuss.elastic.co/u/_Alex)\
**Post date:** [November 1, 2018, 1:09pm UTC](https://discuss.elastic.co/t/error-while-connecting-logstash-to-elastic-search/154965/2 "2018-11-01T13:09:45Z")

</div>

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/
```

---

<div class="post-metadata">

**Author:** ![vnallamothu](https://avatars.discourse-cdn.com/v4/letter/v/35a633/32.png) [@vnallamothu](https://discuss.elastic.co/u/vnallamothu)\
**Post date:** [November 1, 2018, 2:36pm UTC](https://discuss.elastic.co/t/error-while-connecting-logstash-to-elastic-search/154965/3 "2018-11-01T14:36:42Z")

</div>

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 =&gt; localhost:9200 protocol =>; "http" port ="9200" } }' --path.settings /etc/logstash/`

Hope this works!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 29, 2018, 2:36pm UTC](https://discuss.elastic.co/t/error-while-connecting-logstash-to-elastic-search/154965/4 "2018-11-29T14:36:44Z")

</div>

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