# Multipe host output using keystore passwords

**URL:** <https://discuss.elastic.co/t/multipe-host-output-using-keystore-passwords/260090>\
**Category:** Logstash\
**Created:** [January 4, 2021, 12:11pm UTC](https://discuss.elastic.co/t/multipe-host-output-using-keystore-passwords/260090 "2021-01-04T12:11:36Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mcosta](https://avatars.discourse-cdn.com/v4/letter/m/6a8cbe/32.png) [@mcosta](https://discuss.elastic.co/u/mcosta)\
**Post date:** [January 4, 2021, 12:11pm UTC](https://discuss.elastic.co/t/multipe-host-output-using-keystore-passwords/260090/1 "2021-01-04T12:11:36Z")

</div>

Hi All,

I need to configure logstash (ver 7.7) to write to two elastisearch. I have two separate output blocks, one for each elasticsearch but how do I configure password retrieval from keystore, since documentation refer:

- In configuration files, use: output { elasticsearch {...password =\> "${ES\_PWD}" } } }
- In logstash.yml , use: xpack.management.elasticsearch.password: ${ES\_PWD}

I can use different variables, like {ES\_PWD1} and {ES\_PWD2}, for each output block but how do I refer both in logstash.yml xpack.management.elasticsearch.password line?

Thank you

---

<div class="post-metadata">

**Author:** ![ylasri](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ylasri/32/86120_2.png) [@ylasri](https://discuss.elastic.co/u/ylasri)\
**Post date:** [January 4, 2021, 12:22pm UTC](https://discuss.elastic.co/t/multipe-host-output-using-keystore-passwords/260090/2 "2021-01-04T12:22:56Z")

</div>

xpack.management.elasticsearch.password is the password of your elasticsearch cluster where you want to use centralized management of pipelines.  
You will need to choose one cluster for that

> **[Configuring Centralized Pipeline Management | Logstash Reference \[7.10\] |...](https://www.elastic.co/guide/en/logstash/current/configuring-centralized-pipelines.html)**

---

<div class="post-metadata">

**Author:** ![mcosta](https://avatars.discourse-cdn.com/v4/letter/m/6a8cbe/32.png) [@mcosta](https://discuss.elastic.co/u/mcosta)\
**Post date:** [January 4, 2021, 4:15pm UTC](https://discuss.elastic.co/t/multipe-host-output-using-keystore-passwords/260090/3 "2021-01-04T16:15:45Z")

</div>

Thank you for your reply.

I don't have centralized pipelines (pipeline management is done by editing files on /etc/logstash/conf.d directory) but I have a requirement for writing in one of two elasticsearch, depending on a if condition of output block.

I know that I can also use user and password explicitly on each output block but that's not very secure/elegant solution (hardcoded user/pass) compared with password retrieval from keystore.

I guess I'm not the first to have the need to write into multiple elasticsearch, from one logstash without centralized pipeline management.

Is it possible to not have xpack.management.elasticsearch.password: {ES\_PWD} in logstash.yml and still use output { elasticsearch {...password =\> "{ES\_PWD}" } } } on each output block?

---

<div class="post-metadata">

**Author:** ![ylasri](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ylasri/32/86120_2.png) [@ylasri](https://discuss.elastic.co/u/ylasri)\
**Post date:** [January 4, 2021, 4:21pm UTC](https://discuss.elastic.co/t/multipe-host-output-using-keystore-passwords/260090/4 "2021-01-04T16:21:53Z")

</div>

Why you need xpack.management.elasticsearch.password ? it's only used for monitoring the pipelines and if that's you requirement you can monitor them only in one cluster

Now you can output data to mulitple elasticsearch cluster and for each one you need to store the password in the keystore with a specific key

SO basically you can have :

- output { elasticsearch {...password =\> "${ES\_PWD\_ES1}" } } }
- output { elasticsearch {...password =\> "${ES\_PWD\_ES2}" } } }
- output { elasticsearch {...password =\> "${ES\_PWD\_ES3}" } } }
- output { elasticsearch {...password =\> "${ES\_PWD\_ES4}" } } }
- output { elasticsearch {...password =\> "${ES\_PWD\_ES5}" } } }

---

<div class="post-metadata">

**Author:** ![mcosta](https://avatars.discourse-cdn.com/v4/letter/m/6a8cbe/32.png) [@mcosta](https://discuss.elastic.co/u/mcosta)\
**Post date:** [January 4, 2021, 4:29pm UTC](https://discuss.elastic.co/t/multipe-host-output-using-keystore-passwords/260090/5 "2021-01-04T16:29:29Z")

</div>

Great!  
Thank you and keep safe 😷

---

<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 1, 2021, 4:30pm UTC](https://discuss.elastic.co/t/multipe-host-output-using-keystore-passwords/260090/6 "2021-02-01T16:30:11Z")

</div>

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