# Connecting logstash to Elasticsearch via SSL

**URL:** <https://discuss.elastic.co/t/connecting-logstash-to-elasticsearch-via-ssl/308828>\
**Category:** Logstash\
**Created:** [July 4, 2022, 4:38pm UTC](https://discuss.elastic.co/t/connecting-logstash-to-elasticsearch-via-ssl/308828 "2022-07-04T16:38:24Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![dsilvera](https://avatars.discourse-cdn.com/v4/letter/d/bc8723/32.png) [@dsilvera](https://discuss.elastic.co/u/dsilvera)\
**Post date:** [July 4, 2022, 4:38pm UTC](https://discuss.elastic.co/t/connecting-logstash-to-elasticsearch-via-ssl/308828/1 "2022-07-04T16:38:24Z")

</div>

So I have read that since v8.0 Elasticsearch has encryption turned on by default for connections from Logstash, Kabana, Beats.

But I'm not finding a guide on how to setup the certificate and connect to Elasticsearch from Logstash in the output section of the conf file.

I see Elasticsearch on installation, has created a self-signed certificate, but how do I use that with logstash?

Appreciate the help.

---

<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:** [July 4, 2022, 5:12pm UTC](https://discuss.elastic.co/t/connecting-logstash-to-elasticsearch-via-ssl/308828/2 "2022-07-04T17:12:38Z")

</div>

See [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/configuring-stack-security.html#_connect_clients_to_elasticsearch_5)

So You need to make that CA certificate That was generated by Elasticsearch available for logstash... Copy it to where logstash is running.

See [here](https://www.elastic.co/guide/en/logstash/current/plugins-outputs-elasticsearch.html#plugins-outputs-elasticsearch-cacert)

In short in the elasticsearch output section you will set

`"cacert => /path/to/cert/http_ca.crt"`

Or you can disable the check which is discouraged using

`ssl_certificate_verification => false`

---

<div class="post-metadata">

**Author:** ![dsilvera](https://avatars.discourse-cdn.com/v4/letter/d/bc8723/32.png) [@dsilvera](https://discuss.elastic.co/u/dsilvera)\
**Post date:** [July 4, 2022, 5:41pm UTC](https://discuss.elastic.co/t/connecting-logstash-to-elasticsearch-via-ssl/308828/3 "2022-07-04T17:41:28Z")

</div>

Thanks @stephenb .  
Will try this and report back.

---

<div class="post-metadata">

**Author:** ![dsilvera](https://avatars.discourse-cdn.com/v4/letter/d/bc8723/32.png) [@dsilvera](https://discuss.elastic.co/u/dsilvera)\
**Post date:** [July 10, 2022, 1:53am UTC](https://discuss.elastic.co/t/connecting-logstash-to-elasticsearch-via-ssl/308828/4 "2022-07-10T01:53:51Z")

</div>

Thank you Stephen. That worked for me.

---

<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:** [July 10, 2022, 1:55am UTC](https://discuss.elastic.co/t/connecting-logstash-to-elasticsearch-via-ssl/308828/5 "2022-07-10T01:55:45Z")

</div>

Which One Worked? Did you get the cert to work?

---

<div class="post-metadata">

**Author:** ![dsilvera](https://avatars.discourse-cdn.com/v4/letter/d/bc8723/32.png) [@dsilvera](https://discuss.elastic.co/u/dsilvera)\
**Post date:** [July 10, 2022, 2:01am UTC](https://discuss.elastic.co/t/connecting-logstash-to-elasticsearch-via-ssl/308828/6 "2022-07-10T02:01:32Z")

</div>

I copied the cert from the elasticsearch folder and placed it in the logstash folder and added the:

```auto
cacert => "\path\to\cert\http_ca.crt"

```

to my logstash.conf output section.

---

<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:** [August 7, 2022, 2:02am UTC](https://discuss.elastic.co/t/connecting-logstash-to-elasticsearch-via-ssl/308828/7 "2022-08-07T02:02:30Z")

</div>

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