mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 06:37:19 -04:00
fix password field in mongodb auth to be of type password and not string for masked logging
This commit is contained in:
parent
30c631a9f1
commit
4831d209af
1 changed files with 4 additions and 4 deletions
|
@ -14,8 +14,8 @@ class LogStash::Outputs::Mongodb < LogStash::Outputs::Base
|
|||
# The database to use
|
||||
config :database, :validate => :string, :required => true
|
||||
|
||||
config :username, :validate => :string, :required => false
|
||||
config :password, :validate => :string, :required => false
|
||||
config :user, :validate => :string, :required => false
|
||||
config :password, :validate => :password, :required => false
|
||||
|
||||
# The collection to use. This value can use %{foo} values to dynamically
|
||||
# select a collection based on data in the event.
|
||||
|
@ -27,8 +27,8 @@ class LogStash::Outputs::Mongodb < LogStash::Outputs::Base
|
|||
# TODO(petef): check for errors
|
||||
db = Mongo::Connection.new(@host, @port).db(@database)
|
||||
auth = true
|
||||
if @username then
|
||||
auth = db.authenticate(@username, @password) if @username
|
||||
if @user then
|
||||
auth = db.authenticate(@user, @password.value) if @user
|
||||
end
|
||||
if not auth then
|
||||
raise RuntimeError, "MongoDB authentication failure"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue