# Elasticsearch output pipeline error with api\_key

**URL:** <https://discuss.elastic.co/t/elasticsearch-output-pipeline-error-with-api-key/287618>\
**Category:** Logstash\
**Created:** [October 25, 2021, 6:09pm UTC](https://discuss.elastic.co/t/elasticsearch-output-pipeline-error-with-api-key/287618 "2021-10-25T18:09:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wonder\_Garance](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wonder_garance/32/91180_2.png) [@Wonder\_Garance](https://discuss.elastic.co/u/Wonder_Garance)\
**Post date:** [October 25, 2021, 6:09pm UTC](https://discuss.elastic.co/t/elasticsearch-output-pipeline-error-with-api-key/287618/1 "2021-10-25T18:09:49Z")

</div>

Hello, I created a Logstash config to send files on index of Elasticsearch 7.15.1, on the same server.  
I got this error

> [ERROR][logstash.javapipeline][main] Pipeline error {:pipeline\_id=\>"main", :exception=\>#\<Manticore::UnknownException: Unsupported or unrecognized SSL message\>, :backtrace=\>["/opt/logstash-7.15.1/vendor/bundle/jruby/2.5.0/gems/manticore-0.7.1-java/lib/manticore/response.rb:36:in `block in initialize'"

Here is my logstash.yml:

```auto
xpack.monitoring.enabled: true
xpack.monitoring.pipeline.id: ["xxx", "yyy"]
xpack.monitoring.elasticsearch.hosts: "http://localhost:9200"
xpack.monitoring.elasticsearch.api_key: "9dfjeijroek:9eVqMml3Sh6dfdfd"
xpack.monitoring.collection.interval: 10s

```

And the Logstash config file:

```auto
input {
        file {
                path => "/elasticsearch/data/*" start_position => "beginning"
                }
}
filter {
        mutate {
                rename => { ".txt" => ".json" }
        }
}
output {
        elasticsearch {
                hosts => ["https://localhost:9200"]
                api_key => "9dfjeijroek:9eVqMml3Sh6dfdfd"
                ssl => true
        }
}

```

How can I resolve this problem ? Thanks anyway.

---

<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:** [October 25, 2021, 7:15pm UTC](https://discuss.elastic.co/t/elasticsearch-output-pipeline-error-with-api-key/287618/2 "2021-10-25T19:15:32Z")

</div>

You have configured http in one place and https in the other. Is Elasticsearch using TLS?

---

<div class="post-metadata">

**Author:** ![Wonder\_Garance](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wonder_garance/32/91180_2.png) [@Wonder\_Garance](https://discuss.elastic.co/u/Wonder_Garance)\
**Post date:** [October 25, 2021, 9:36pm UTC](https://discuss.elastic.co/t/elasticsearch-output-pipeline-error-with-api-key/287618/3 "2021-10-25T21:36:21Z")

</div>

Thank you, I changed my config as this:  
`hosts => ["http://localhost:9200"]`

I also added ssl certificate in my config:

```auto
output {
        elasticsearch {
                hosts => ["http://localhost:9200"]
                api_key => "9dfjeijroek:9eVqMml3Sh6dfdfd"
                ssl => true
                ssl_certificate => "/etc/client/cert.pem"
                ssl_key => "/etc/client/cert.key"
        }
}

```

And now I meet a new error:  
Using api\_key authentication requires SSL/TLS secured communication

---

<div class="post-metadata">

**Author:** ![Wonder\_Garance](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wonder_garance/32/91180_2.png) [@Wonder\_Garance](https://discuss.elastic.co/u/Wonder_Garance)\
**Post date:** [October 27, 2021, 8:49am UTC](https://discuss.elastic.co/t/elasticsearch-output-pipeline-error-with-api-key/287618/4 "2021-10-27T08:49:09Z")

</div>

@Badger Thanks a lot, I resolved the problem.

I added TLS on the HTTP layer:

> **[Set up basic security for the Elastic Stack plus secured HTTPS traffic |...](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-basic-setup-https.html)**

And I modified my Logstash conf:

```auto
input {
        file {
                path => "/elasticsearch/data/*" start_position => "beginning" sincedb_path => "/dev/null"
                }
}
filter {
        mutate {
                rename => { ".txt" => ".json" }
        }
}
output {
        elasticsearch {
                hosts => ["https://localhost:9200"]
                index => "test"
                user => "elastic"
                password => "kjdfidoie"
                ssl => true
                cacert => "/etc/client/elasticsearch-ca.pem"
        }
}

```

---

<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 24, 2021, 8:50am UTC](https://discuss.elastic.co/t/elasticsearch-output-pipeline-error-with-api-key/287618/5 "2021-11-24T08:50:02Z")

</div>

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