# Logstash cant connect to Elasticsearch

**URL:** <https://discuss.elastic.co/t/logstash-cant-connect-to-elasticsearch/176107>\
**Category:** Logstash\
**Created:** [April 9, 2019, 9:26pm UTC](https://discuss.elastic.co/t/logstash-cant-connect-to-elasticsearch/176107 "2019-04-09T21:26:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Savagepony](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/savagepony/32/55262_2.png) [@Savagepony](https://discuss.elastic.co/u/Savagepony)\
**Post date:** [April 9, 2019, 9:27pm UTC](https://discuss.elastic.co/t/logstash-cant-connect-to-elasticsearch/176107/1 "2019-04-09T21:27:00Z")

</div>

I am getting the below error when I am starting the logstash

[2019-04-09T17:19:18,094][WARN][logstash.outputs.elasticsearch] Attempted to resurrect connection to dead ES instance, but got an error. {:url=\>"[https://localhost:9300/](https://localhost:9300/)", :error\_type=\>LogStash::Outputs::ElasticSearch::HttpClient::Pool::HostUnreachableError, :error=\>"Elasticsearch Unreachable: [[https://localhost:9300/](https://localhost:9300/)][Manticore::ClientProtocolException] PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target"}

My Logstash.config file input:

input {  
beats {  
port =\> 5044  
}  
}

Output:

if [type] == "smaccess" or [type] == "smps" or [type] == "agent" or [type] == "agenttrace" {  
stdout { codec =\> rubydebug }  
elasticsearch {  
hosts =\> ["localhost:9300"]  
index =\> "siteminder-%{+YYYY.MM.dd}"  
ssl =\> true  
ssl\_certificate\_verification =\> true  
truststore =\> "/etc/xuv0/apps/elk/elasticsearch-6.5.4/config/client.truststore.jks"  
truststore\_password =\> storepass  
}  
} else {  
elasticsearch {  
hosts =\> ["localhost:9300"]  
ssl =\> true  
ssl\_certificate\_verification =\> true  
truststore =\> "/etc/xuv0/apps/elk/elasticsearch-6.5.4/config/client.truststore.jks"  
truststore\_password =\> storepass  
}  
}  
}

Can anyone please help me on this? I am not sure why does is it say dead ES instance, both the ports 9200 and 9300 are up and running. Also I gave the correct path to the truststore but still it says can't find the certification path. Please help.

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [April 9, 2019, 9:32pm UTC](https://discuss.elastic.co/t/logstash-cant-connect-to-elasticsearch/176107/2 "2019-04-09T21:32:38Z")

</div>

> [@Savagepony](#):
>
> I am not sure why does is it say dead ES instance, both the ports 9200 and 9300 are up and running.

It is telling you it cannot establish a connection. The reason for that is that it cannot validate the certificate that elasticsearch is presenting.

I cannot test it, but if I recall correctly you need the chain in the truststore, not just the leaf certificate.

---

<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:** [May 7, 2019, 9:32pm UTC](https://discuss.elastic.co/t/logstash-cant-connect-to-elasticsearch/176107/3 "2019-05-07T21:32:40Z")

</div>

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