# How to save and retrieve usernames and passwords from logstash config

**URL:** <https://discuss.elastic.co/t/how-to-save-and-retrieve-usernames-and-passwords-from-logstash-config/73037>\
**Category:** Logstash\
**Created:** [January 27, 2017, 4:27pm UTC](https://discuss.elastic.co/t/how-to-save-and-retrieve-usernames-and-passwords-from-logstash-config/73037 "2017-01-27T16:27:11Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![gmmurugan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gmmurugan/32/12488_2.png) [@gmmurugan](https://discuss.elastic.co/u/gmmurugan)\
**Post date:** [January 27, 2017, 4:27pm UTC](https://discuss.elastic.co/t/how-to-save-and-retrieve-usernames-and-passwords-from-logstash-config/73037/1 "2017-01-27T16:27:11Z")

</div>

i need to get a password to connect to database using jdbc plugin. please let me know best vault method to use inside logstash config

```
jdbc_connection_string => "jdbc:db2://xxxxxxxxxxxxxx:port"
	jdbc_user => "username"
	jdbc_password => "@string??/variable"
	# or jdbc_password_filepath => "/path/to/my/password_file"
```

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [January 27, 2017, 6:39pm UTC](https://discuss.elastic.co/t/how-to-save-and-retrieve-usernames-and-passwords-from-logstash-config/73037/2 "2017-01-27T18:39:12Z")

</div>

There's no support for a "vault method". The password needs to be stored in plain text, either in the config file or in the `jdbc_password_filepath` file.

---

<div class="post-metadata">

**Author:** ![gmmurugan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gmmurugan/32/12488_2.png) [@gmmurugan](https://discuss.elastic.co/u/gmmurugan)\
**Post date:** [January 30, 2017, 5:06pm UTC](https://discuss.elastic.co/t/how-to-save-and-retrieve-usernames-and-passwords-from-logstash-config/73037/3 "2017-01-30T17:06:28Z")

</div>

we need better solution.. 🙂

---

<div class="post-metadata">

**Author:** ![gmmurugan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gmmurugan/32/12488_2.png) [@gmmurugan](https://discuss.elastic.co/u/gmmurugan)\
**Post date:** [January 31, 2017, 4:44pm UTC](https://discuss.elastic.co/t/how-to-save-and-retrieve-usernames-and-passwords-from-logstash-config/73037/4 "2017-01-31T16:44:10Z")

</div>

Unknown setting 'jdbc\_password\_filepath' for jdbc {:level=\>:error}

how eaxtly we need to save in the file.. just the password saved in the first line of the file?

---

<div class="post-metadata">

**Author:** ![gmmurugan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gmmurugan/32/12488_2.png) [@gmmurugan](https://discuss.elastic.co/u/gmmurugan)\
**Post date:** [January 31, 2017, 5:24pm UTC](https://discuss.elastic.co/t/how-to-save-and-retrieve-usernames-and-passwords-from-logstash-config/73037/5 "2017-01-31T17:24:03Z")

</div>

i m getting error when i save in plain text and pointed them using the jdbc\_password\_filepath

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [January 31, 2017, 6:13pm UTC](https://discuss.elastic.co/t/how-to-save-and-retrieve-usernames-and-passwords-from-logstash-config/73037/6 "2017-01-31T18:13:41Z")

</div>

> Unknown setting 'jdbc\_password\_filepath' for jdbc {:level=\>:error}

Do you have at least 4.0.2 of the jdbc input plugin? Check with the logstash-plugin command. Also, please show your current configuration.

> how eaxtly we need to save in the file.. just the password saved in the first line of the file?

Yes.

> i m getting error when i save in plain text and pointed them using the jdbc\_password\_filepath

What error do you get?

---

<div class="post-metadata">

**Author:** ![gmmurugan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gmmurugan/32/12488_2.png) [@gmmurugan](https://discuss.elastic.co/u/gmmurugan)\
**Post date:** [January 31, 2017, 10:16pm UTC](https://discuss.elastic.co/t/how-to-save-and-retrieve-usernames-and-passwords-from-logstash-config/73037/7 "2017-01-31T22:16:47Z")

</div>

> [@magnusbaeck](#):
>
> Do you have at least 4.0.2 of the jdbc input plugin?
> 
> Check with the logstash-plugin command. Also, please show your current configuration.

i have 3.0.2, and when i update, there is lot of dependencies. any easy way to update the below and install jdbc plugin to 4.0.2/latest?

- logstash-core-plugin-api ~ depends on logstash-core  
-logstash-input-irc.. etc

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [February 1, 2017, 6:57am UTC](https://discuss.elastic.co/t/how-to-save-and-retrieve-usernames-and-passwords-from-logstash-config/73037/8 "2017-02-01T06:57:28Z")

</div>

It sounds like you're running Logstash 2.3 or earlier. In that case you need to upgrade.

---

<div class="post-metadata">

**Author:** ![gmmurugan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gmmurugan/32/12488_2.png) [@gmmurugan](https://discuss.elastic.co/u/gmmurugan)\
**Post date:** [February 1, 2017, 1:07pm UTC](https://discuss.elastic.co/t/how-to-save-and-retrieve-usernames-and-passwords-from-logstash-config/73037/9 "2017-02-01T13:07:08Z")

</div>

can we update the logstash alone. If we update them to higher version, do I  
need to update elastic search and kibana? I also checked if we can update  
the Gemlist and bundle update. But I don't know I can do that.  
However which version of logstash supports password on file ?

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [February 1, 2017, 1:16pm UTC](https://discuss.elastic.co/t/how-to-save-and-retrieve-usernames-and-passwords-from-logstash-config/73037/10 "2017-02-01T13:16:14Z")

</div>

> can we update the logstash alone. If we update them to higher version, do I need to update Elasticsearch and kibana?

No.

> However which version of logstash supports password on file ?

I think you need 2.4 or later, but why run anything but the latest?

---

<div class="post-metadata">

**Author:** ![gmmurugan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gmmurugan/32/12488_2.png) [@gmmurugan](https://discuss.elastic.co/u/gmmurugan)\
**Post date:** [February 1, 2017, 1:50pm UTC](https://discuss.elastic.co/t/how-to-save-and-retrieve-usernames-and-passwords-from-logstash-config/73037/11 "2017-02-01T13:50:21Z")

</div>

Looks like cookbook we use have been based on 2.3 version of logstash.I  
don't know the impact if I change the logstash version to 5. So would like  
to know for all

---

<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:** [March 1, 2017, 1:50pm UTC](https://discuss.elastic.co/t/how-to-save-and-retrieve-usernames-and-passwords-from-logstash-config/73037/12 "2017-03-01T13:50:54Z")

</div>

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