Configure mongodb as input in logstash config file


(Nandakumar K) #1

We want to sync data from mongodb into elastic search using logstash. we created an config file as below

input {
mongodb {
uri => 'mongodb://demouser:demo@password%@localhost:27017/demodb'
placeholder_db_dir => 'C:\logstash-6.5.1\logstash-6.5.1\vendor\bundle\jruby\2.3.0\gems\logstash-input-sqlite-3.0.4\lib\logstash\inputs'
placeholder_db_name => 'logstash_sqlite.db'
collection => 'program'
batch_size => 5000
codec => 'json'
}
}
output {
elasticsearch {
index => "program" hosts => ["http://localhost:9200"]
document_type => "doc"
document_id => "%{id}"
}
}

We have problem with password because it contain special character @. So there is using of two @ character usage. Is there any way to seperate username and password as seperate one. Also Is above configuration is valid one?