# LogStash::Outputs::ElasticSearch::HttpClient::Pool::BadResponseCodeError: Got response code '401' contacting Elasticsearc

**URL:** <https://discuss.elastic.co/t/logstash-got-response-code-401-contacting-elasticsearc/260209>\
**Category:** Logstash\
**Tags:** docker\
**Created:** [January 5, 2021, 1:27pm UTC](https://discuss.elastic.co/t/logstash-got-response-code-401-contacting-elasticsearc/260209 "2021-01-05T13:27:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gitusersybchina](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gitusersybchina/32/81776_2.png) [@gitusersybchina](https://discuss.elastic.co/u/gitusersybchina)\
**Post date:** [January 5, 2021, 1:27pm UTC](https://discuss.elastic.co/t/logstash-got-response-code-401-contacting-elasticsearc/260209/1 "2021-01-05T13:27:31Z")

</div>

when I deploy logstash in k8s and config out to es，the pod has occur this error log:

```auto
LogStash::Outputs::ElasticSearch::HttpClient::Pool::BadResponseCodeError: Got response code '401' contacting Elasticsearch

Failed to install template. {:message=>"Got response code '401' contacting Elasticsearch at URL 'https://search-hops-log-xxxxxxxxxxxxxx.ap-northeast-1.es.amazonaws.com:443/_xpack'", :class=>"LogStash::Outputs::ElasticSearch::HttpClient::Pool::BadResponseCodeError",

```

this is my logstash config，please help me

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/a/f/afd2af3e0e979f396b6e4f4ce7b5188b2aeb045d.png)  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/d/a/da4b31e2014a7d1c9651cd4d655c09fcaa86e2c4.png)

---

<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:** [February 2, 2021, 1:27pm UTC](https://discuss.elastic.co/t/logstash-got-response-code-401-contacting-elasticsearc/260209/2 "2021-02-02T13:27:45Z")

</div>

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