# Read jdbc password from shell script output

**URL:** <https://discuss.elastic.co/t/read-jdbc-password-from-shell-script-output/123543>\
**Category:** Logstash\
**Created:** [March 12, 2018, 12:19pm UTC](https://discuss.elastic.co/t/read-jdbc-password-from-shell-script-output/123543 "2018-03-12T12:19:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rons1404](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rons1404/32/28793_2.png) [@rons1404](https://discuss.elastic.co/u/rons1404)\
**Post date:** [March 12, 2018, 12:19pm UTC](https://discuss.elastic.co/t/read-jdbc-password-from-shell-script-output/123543/1 "2018-03-12T12:19:29Z")

</div>

Hey,  
Is it possible to set jdbc\_password as output of some script?  
I want to read the password from a global variable, but it's encrypted so I need to call some shell script to decrypt it. The only option I see is to extend the built-in jdbc plugin, is there another way?

---

<div class="post-metadata">

**Author:** ![pjanzen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pjanzen/32/13756_2.png) [@pjanzen](https://discuss.elastic.co/u/pjanzen)\
**Post date:** [March 12, 2018, 12:24pm UTC](https://discuss.elastic.co/t/read-jdbc-password-from-shell-script-output/123543/2 "2018-03-12T12:24:27Z")

</div>

This might help

[https://www.elastic.co/guide/en/logstash/current/environment-variables.html](https://www.elastic.co/guide/en/logstash/current/environment-variables.html)

---

<div class="post-metadata">

**Author:** ![rons1404](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rons1404/32/28793_2.png) [@rons1404](https://discuss.elastic.co/u/rons1404)\
**Post date:** [March 12, 2018, 1:26pm UTC](https://discuss.elastic.co/t/read-jdbc-password-from-shell-script-output/123543/3 "2018-03-12T13:26:41Z")

</div>

Thanks for the response, I checked your link and mutate doesn't solve my issue.  
I need to run a shell script from within the Logstash and save the return value of that script into a variable.

---

<div class="post-metadata">

**Author:** ![pjanzen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pjanzen/32/13756_2.png) [@pjanzen](https://discuss.elastic.co/u/pjanzen)\
**Post date:** [March 12, 2018, 1:37pm UTC](https://discuss.elastic.co/t/read-jdbc-password-from-shell-script-output/123543/4 "2018-03-12T13:37:31Z")

</div>

I am do not know which version of logstash you are using but you could edit the file: /etc/systemd/system/logstash.service  
There is a line that reads:  
`ExecStart=/usr/share/logstash/bin/logstash "--path.settings" "/etc/logstash"`  
You could add:  
`export JDBC_PASSWORD=<decrypt you password command>; usr/share/logstash/bin/logstash "--path.settings" "/etc/logstash"`

It just might do the trick.

---

<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:** [April 9, 2018, 1:37pm UTC](https://discuss.elastic.co/t/read-jdbc-password-from-shell-script-output/123543/5 "2018-04-09T13:37:49Z")

</div>

Closed on April 9, 2018, 1:37pm UTC

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