# Logstash Issue: Got response code '401' contacting Elasticsearch at URL 'http://localhost:9200/'

**URL:** https://discuss.elastic.co/t/logstash-issue-got-response-code-401-contacting-elasticsearch-at-url-http-localhost-9200/294395
**Category:** Logstash
**Created:** [January 14, 2022, 9:55am UTC](https://discuss.elastic.co/t/logstash-issue-got-response-code-401-contacting-elasticsearch-at-url-http-localhost-9200/294395 "2022-01-14T09:55:56Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Abhishek\_Gautam](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/abhishek_gautam/32/99831_2.png) [@Abhishek\_Gautam](https://discuss.elastic.co/u/Abhishek_Gautam)
#### Post date: [January 14, 2022, 9:55am UTC](https://discuss.elastic.co/t/logstash-issue-got-response-code-401-contacting-elasticsearch-at-url-http-localhost-9200/294395/1 "2022-01-14T09:55:56Z")

</div>

while trying to run logstash 7.16.3 with this current version of Elasticsearch 8.1.0 .  
I get the following error.

`{:url=>"http://localhost:9200/", :exception=>LogStash::Outputs::ElasticSearch::HttpClient::Pool::BadResponseCodeError, :message=>"Got response code '401' contacting Elasticsearch at URL 'http://localhost:9200/'"}`

Can you suggest a possible solution for this issue...?

---

<div class="post-metadata">

### Author: ![AquaX](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aquax/32/92006_2.png) [@AquaX](https://discuss.elastic.co/u/AquaX)
#### Post date: [January 14, 2022, 5:08pm UTC](https://discuss.elastic.co/t/logstash-issue-got-response-code-401-contacting-elasticsearch-at-url-http-localhost-9200/294395/2 "2022-01-14T17:08:34Z")

</div>

You are not authorized. Ensure that your logstash output has proper credentials for your Elasticsearch instance.

> **[Elasticsearch output plugin | Logstash Reference \[7.16\] | Elastic](https://www.elastic.co/guide/en/logstash/current/plugins-outputs-elasticsearch.html#_authentication_2)**

---

<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 11, 2022, 5:09pm UTC](https://discuss.elastic.co/t/logstash-issue-got-response-code-401-contacting-elasticsearch-at-url-http-localhost-9200/294395/3 "2022-02-11T17:09:32Z")

</div>

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