# Exiting: couldn't connect to any of the configured Elasticsearch hosts. Errors: \[error connecting to Elasticsearch

**URL:** https://discuss.elastic.co/t/exiting-couldnt-connect-to-any-of-the-configured-elasticsearch-hosts-errors-error-connecting-to-elasticsearch/317060
**Category:** Elasticsearch
**Created:** [October 20, 2022, 12:25am UTC](https://discuss.elastic.co/t/exiting-couldnt-connect-to-any-of-the-configured-elasticsearch-hosts-errors-error-connecting-to-elasticsearch/317060 "2022-10-20T00:25:08Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Joao\_Malebo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joao_malebo/32/111764_2.png) [@Joao\_Malebo](https://discuss.elastic.co/u/Joao_Malebo)
#### Post date: [October 20, 2022, 12:25am UTC](https://discuss.elastic.co/t/exiting-couldnt-connect-to-any-of-the-configured-elasticsearch-hosts-errors-error-connecting-to-elasticsearch/317060/1 "2022-10-20T00:25:08Z")

</div>

Hello dears,

I'm getting errors when running filebeats on a remote server to test the Elasticsearch connection

Below is the error image and description.

sudo filebeat setup -E output.logstash.enabled=false -E output.elasticsearch.hosts=['10.35.33.65:9200'] -E setup.kibana.host=10.35.33.65:5601  
Exiting: couldn't connect to any of the configured Elasticsearch hosts. Errors: [error connecting to Elasticsearch at [http://10.35.33.65:9200](http://10.35.33.65:9200): Get "[http://10.35.33.65:9200](http://10.35.33.65:9200)": EOF]  
[rcmag.kta@XXXXXXXXX~]$

 ![elastic](https://us1.discourse-cdn.com/elastic/original/3X/7/a/7a41402a88de56daf9422dd1dcb7378a821fd0d1.png)

segue a configuração do /etc/filebeat/filebeat.yml

* * *

---------------------------- Elasticsearch Output ----------------------------  
output.elasticsearch:  
\<# Array of hosts to connect to./\>  
hosts: ["[https://10.35.33.65:9200](https://10.35.33.65:9200)"]

\<# Protocol - either `http` (default) or `https`./\>  
#protocol: "https"

\<# Authentication credentials - either API key or username/password./\>

#api\_key: "id:api\_key"  
#username: "elastic"  
#password: "changeme"

\< # ------------------------------ Logstash Output ------------------------------- /\>  
output.logstash:  
\< # The Logstash hosts /\>  
hosts: ["10.35.33.65:5044"]

\< # Optional SSL. By default is off. /\>  
\< # List of root certificates for HTTPS server verifications /\>  
#ssl.certificate\_authorities: ["/etc/pki/root/ca.pem"]

\< # Certificate for SSL client authentication /\>  
#ssl.certificate: "/etc/pki/client/cert.pem"

\< # Client Certificate Key /\>  
#ssl.key: "/etc/pki/client/cert.key"

* * *

Can you please help.

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [October 20, 2022, 2:35am UTC](https://discuss.elastic.co/t/exiting-couldnt-connect-to-any-of-the-configured-elasticsearch-hosts-errors-error-connecting-to-elasticsearch/317060/2 "2022-10-20T02:35:40Z")

</div>

Please don't post pictures of text, logs or code. They are difficult to read, impossible to search and replicate (if it's code), and some people may not be even able to see them.

Please also format your code/logs/config using the `</>` button, or markdown style back ticks. It helps to make things easy to read which helps us help you 🙂

---

<div class="post-metadata">

### Author: ![Joao\_Malebo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joao_malebo/32/111764_2.png) [@Joao\_Malebo](https://discuss.elastic.co/u/Joao_Malebo)
#### Post date: [October 20, 2022, 10:14am UTC](https://discuss.elastic.co/t/exiting-couldnt-connect-to-any-of-the-configured-elasticsearch-hosts-errors-error-connecting-to-elasticsearch/317060/3 "2022-10-20T10:14:29Z")

</div>

follow the formatted file settings as requested

sudo vi /etc/filebeat/filebeat.yml

---------------------------- Elasticsearch Output ----------------------------  
output.elasticsearch:  
\<# Array of hosts to connect to./\>  
hosts: ["[https://10.35.33.65:9200](https://10.35.33.65:9200/)"]

\<# Protocol - either `http` (default) or `https`./\>  
#protocol: "https"

\<# Authentication credentials - either API key or username/password./\>

#api\_key: "id:api\_key"  
#username: "elastic"  
#password: "changeme"

\< # ------------------------------ Logstash Output ------------------------------- /\>  
output.logstash:  
\< # The Logstash hosts /\>  
hosts: ["10.35.33.65:5044"]

\< # Optional SSL. By default is off. /\>  
\< # List of root certificates for HTTPS server verifications /\>  
#ssl.certificate\_authorities: ["/etc/pki/root/ca.pem"]

\< # Certificate for SSL client authentication /\>  
#ssl.certificate: "/etc/pki/client/cert.pem"

\< # Client Certificate Key /\>  
#ssl.key: "/etc/pki/client/cert.key"

---

<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 17, 2022, 10:14am UTC](https://discuss.elastic.co/t/exiting-couldnt-connect-to-any-of-the-configured-elasticsearch-hosts-errors-error-connecting-to-elasticsearch/317060/4 "2022-11-17T10:14:46Z")

</div>

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