Read jdbc password from shell script output

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?

This might help

https://www.elastic.co/guide/en/logstash/current/environment-variables.html

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.

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.

1 Like

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