# How to mention elasticsearch credentials in logstash config?

**URL:** <https://discuss.elastic.co/t/how-to-mention-elasticsearch-credentials-in-logstash-config/279840>\
**Category:** Logstash\
**Created:** [July 28, 2021, 10:36am UTC](https://discuss.elastic.co/t/how-to-mention-elasticsearch-credentials-in-logstash-config/279840 "2021-07-28T10:36:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shreesh\_Narayanan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shreesh_narayanan/32/87312_2.png) [@Shreesh\_Narayanan](https://discuss.elastic.co/u/Shreesh_Narayanan)\
**Post date:** [July 28, 2021, 10:36am UTC](https://discuss.elastic.co/t/how-to-mention-elasticsearch-credentials-in-logstash-config/279840/1 "2021-07-28T10:36:44Z")

</div>

Hello,

I recently enabled x-pack security on elasticsearch and set up passwords for built-in users successfully . However now i get an error when trying to ingest some logs

```auto
[2021-07-23T13:02:58,225][WARN][logstash.outputs.elasticsearch][main] Attempted to resurrect connection to dead ES instance, but got an error {:url=>"http://elastic:xxxxxx@172.26.207.167:9200/", :exception=>LogStash::Outputs::ElasticSearch::HttpClient::Pool::BadResponseCodeError, :message=>"Got response code '401' contacting Elasticsearch at URL 'http://172.26.207.167:9200/'"

```

here's my output section in the logstash config :- I don't want to specify password in plain text, (which works when password is mentioned in plain text) , is there way to mention the keystore value here?

The below format currently works properly

```auto
output {

 elasticsearch { hosts => ["172.26.207.167:9200"]
                        index => "logstash_viz1"
                        user => "elastic"
                        password => "test123"
                }

```

---

<div class="post-metadata">

**Author:** ![varunpappu](https://avatars.discourse-cdn.com/v4/letter/v/58956e/32.png) [@varunpappu](https://discuss.elastic.co/u/varunpappu)\
**Post date:** [July 28, 2021, 10:54am UTC](https://discuss.elastic.co/t/how-to-mention-elasticsearch-credentials-in-logstash-config/279840/2 "2021-07-28T10:54:12Z")

</div>

You can use logstash keystore and eliminate the possibility of putting username and passwords in plaintext.

This article should help you out  
([Secrets keystore for secure settings | Logstash Reference [7.13] | Elastic](https://www.elastic.co/guide/en/logstash/current/keystore.html))

---

<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 25, 2021, 10:54am UTC](https://discuss.elastic.co/t/how-to-mention-elasticsearch-credentials-in-logstash-config/279840/3 "2021-08-25T10:54:13Z")

</div>

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