# SunCertPathBuilderException in Logstash Running Elasticsearch in Docker

**URL:** <https://discuss.elastic.co/t/suncertpathbuilderexception-in-logstash-running-elasticsearch-in-docker/308054>\
**Category:** Logstash\
**Tags:** elastic-stack-security, docker\
**Created:** [June 23, 2022, 8:12pm UTC](https://discuss.elastic.co/t/suncertpathbuilderexception-in-logstash-running-elasticsearch-in-docker/308054 "2022-06-23T20:12:16Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![jhop](https://avatars.discourse-cdn.com/v4/letter/j/ebca7d/32.png) [@jhop](https://discuss.elastic.co/u/jhop)\
**Post date:** [June 23, 2022, 8:12pm UTC](https://discuss.elastic.co/t/suncertpathbuilderexception-in-logstash-running-elasticsearch-in-docker/308054/1 "2022-06-23T20:12:16Z")

</div>

I am running Elasticsearch in docker. I am trying to hit port 5044 from my browser (or from anywhere). My error is as follows:

```auto
sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

```

My logstash.conf file looks like:

```auto
input {
  beats {
    port => 5044
  }
}

output {
  elasticsearch {
    hosts => ["https://localhost:9200"]
    index => "%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY.MM.dd}"
    #user => "elastic"
    #password => "changeMe"
  }
}

```

My logstash file is all commented out.

I have never used keytool before but gave it a try using the cert I copied out of the Elasticsearch container:

```auto
sudo keytool -importcert -file ./http_ca.crt

```

It did not work. Can anyone help?

Thanks,  
Jason

---

<div class="post-metadata">

**Author:** ![jhop](https://avatars.discourse-cdn.com/v4/letter/j/ebca7d/32.png) [@jhop](https://discuss.elastic.co/u/jhop)\
**Post date:** [June 23, 2022, 8:15pm UTC](https://discuss.elastic.co/t/suncertpathbuilderexception-in-logstash-running-elasticsearch-in-docker/308054/2 "2022-06-23T20:15:06Z")

</div>

I meant my logstash.yml file is all commented out.

---

<div class="post-metadata">

**Author:** ![jhop](https://avatars.discourse-cdn.com/v4/letter/j/ebca7d/32.png) [@jhop](https://discuss.elastic.co/u/jhop)\
**Post date:** [June 23, 2022, 9:01pm UTC](https://discuss.elastic.co/t/suncertpathbuilderexception-in-logstash-running-elasticsearch-in-docker/308054/3 "2022-06-23T21:01:47Z")

</div>

For more information, I am able to hit logstash port 9600 with Firefox I cannot with [https://localhost:5044](https://localhost:5044) which gives me Secure Connection Failed. With [http://localhost:5044](http://localhost:5044) I get The connection was reset.

---

<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:** [June 23, 2022, 10:44pm UTC](https://discuss.elastic.co/t/suncertpathbuilderexception-in-logstash-running-elasticsearch-in-docker/308054/4 "2022-06-23T22:44:55Z")

</div>

> [@jhop](#):
>
> I am trying to hit port 5044 from my browser (or from anywhere)

Why?

---

<div class="post-metadata">

**Author:** ![jhop](https://avatars.discourse-cdn.com/v4/letter/j/ebca7d/32.png) [@jhop](https://discuss.elastic.co/u/jhop)\
**Post date:** [June 24, 2022, 12:31pm UTC](https://discuss.elastic.co/t/suncertpathbuilderexception-in-logstash-running-elasticsearch-in-docker/308054/5 "2022-06-24T12:31:29Z")

</div>

To verify it is working.

---

<div class="post-metadata">

**Author:** ![jhop](https://avatars.discourse-cdn.com/v4/letter/j/ebca7d/32.png) [@jhop](https://discuss.elastic.co/u/jhop)\
**Post date:** [June 24, 2022, 1:56pm UTC](https://discuss.elastic.co/t/suncertpathbuilderexception-in-logstash-running-elasticsearch-in-docker/308054/6 "2022-06-24T13:56:48Z")

</div>

Correct me if I am wrong but doesn't elasticsearch need to talk to logstash via port 5044?

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [June 24, 2022, 3:12pm UTC](https://discuss.elastic.co/t/suncertpathbuilderexception-in-logstash-running-elasticsearch-in-docker/308054/7 "2022-06-24T15:12:42Z")

</div>

> [@jhop](#):
>
> Correct me if I am wrong but doesn't elasticsearch need to talk to logstash via port 5044?

No, Elasticsearch does not talk to Logstash, it is the other way.

In the pipeline you shared you have a `beats` input listening in port `5044` and a elasticsearch output, this means that logstash will listen for connections from any beats application on port `5044` and will send it to elasticsearch, on the configured port `9200`.

Trying to access port `5044` in logstash will not work as you need to use a beat to send data, like filebeat, metricbeat, winlogbeat etc.

You can however test the connection using telnet.

---

<div class="post-metadata">

**Author:** ![jhop](https://avatars.discourse-cdn.com/v4/letter/j/ebca7d/32.png) [@jhop](https://discuss.elastic.co/u/jhop)\
**Post date:** [June 24, 2022, 7:00pm UTC](https://discuss.elastic.co/t/suncertpathbuilderexception-in-logstash-running-elasticsearch-in-docker/308054/8 "2022-06-24T19:00:02Z")

</div>

Thanks for the answer my full exception with more information is as follows:

```auto
[https://localhost:9200/][Manticore::ClientProtocolException] PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

```

---

<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:** [July 22, 2022, 7:00pm UTC](https://discuss.elastic.co/t/suncertpathbuilderexception-in-logstash-running-elasticsearch-in-docker/308054/9 "2022-07-22T19:00:31Z")

</div>

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