# Unable to configure filebeat: Could not connect to elasticsearch host

**URL:** https://discuss.elastic.co/t/unable-to-configure-filebeat-could-not-connect-to-elasticsearch-host/354525
**Category:** Beats
**Tags:** filebeat
**Created:** [March 1, 2024, 10:43am UTC](https://discuss.elastic.co/t/unable-to-configure-filebeat-could-not-connect-to-elasticsearch-host/354525 "2024-03-01T10:43:52Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Palak\_Chopra](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/palak_chopra/32/125700_2.png) [@Palak\_Chopra](https://discuss.elastic.co/u/Palak_Chopra)
#### Post date: [March 1, 2024, 10:43am UTC](https://discuss.elastic.co/t/unable-to-configure-filebeat-could-not-connect-to-elasticsearch-host/354525/1 "2024-03-01T10:43:52Z")

</div>

I keep getting this when trying to configure filebeats to elastic

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/3/d/3d4ae0827106192430e9cd3b0cd889bd7f45c9ca.png)  
The key value has been corrected.

filebeat.yml:

```auto
# ---------------------------- Elasticsearch Output ----------------------------
output.elasticsearch:
  # Array of hosts to connect to.
  hosts: ["192.168.56.106:9200"]

  # Protocol - either `http` (default) or `https`.
  #protocol: "http"

  # Authentication credentials - either API key or username/password.
  #api_key: "id:api_key"
  username: "elastic"
  password: "${ELASTIC_PASSWORD}"

```

---

<div class="post-metadata">

### Author: ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)
#### Post date: [March 1, 2024, 11:42am UTC](https://discuss.elastic.co/t/unable-to-configure-filebeat-could-not-connect-to-elasticsearch-host/354525/2 "2024-03-01T11:42:47Z")

</div>

Hi @Palak_Chopra

Please don't post images of text the are hard to read , cannot be cut and paste or debugged searched etc...

That said look at the 3rd line from the bottom.. you are not using the add keystore command correctly

Perhaps take a closer look at the docs don't use `$`

> **[Secrets keystore for secure settings | Filebeat Reference \[8.12\] | Elastic](https://www.elastic.co/guide/en/beats/filebeat/current/keystore.html)**

You can test the output with

`filebeat test output`

---

<div class="post-metadata">

### Author: ![Palak\_Chopra](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/palak_chopra/32/125700_2.png) [@Palak\_Chopra](https://discuss.elastic.co/u/Palak_Chopra)
#### Post date: [March 1, 2024, 12:57pm UTC](https://discuss.elastic.co/t/unable-to-configure-filebeat-could-not-connect-to-elasticsearch-host/354525/3 "2024-03-01T12:57:28Z")

</div>

Sorry about the image.  
I changed the keystore to, for now, a hardcoded password. Are these the elastic credentials or local for filebeat?

This is my output for filebeat test output.

```auto
elasticsearch: http://192.168.56.106:9200...
  parse url... OK
  connection...
    parse host... OK
    dns lookup... OK
    addresses: 192.168.56.106
    dial up... OK
  TLS... WARN secure connection disabled
  talk to server... ERROR Get "http://192.168.56.106:9200": EOF

```

---

<div class="post-metadata">

### Author: ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)
#### Post date: [March 1, 2024, 11:38pm UTC](https://discuss.elastic.co/t/unable-to-configure-filebeat-could-not-connect-to-elasticsearch-host/354525/4 "2024-03-01T23:38:56Z")

</div>

> [@Palak\_Chopra](#):
>
> `output.elasticsearch`

That section is for the output to elasticsearch.

You can use the keystore you just need to run the command with the correct syntax

---

<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: [March 30, 2024, 1:39am UTC](https://discuss.elastic.co/t/unable-to-configure-filebeat-could-not-connect-to-elasticsearch-host/354525/5 "2024-03-30T01:39:41Z")

</div>

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