# Configure mongodb as input in logstash config file

**URL:** <https://discuss.elastic.co/t/configure-mongodb-as-input-in-logstash-config-file/159724>\
**Category:** Logstash\
**Created:** [December 6, 2018, 12:11pm UTC](https://discuss.elastic.co/t/configure-mongodb-as-input-in-logstash-config-file/159724 "2018-12-06T12:11:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nandakumar\_k\_6693](https://avatars.discourse-cdn.com/v4/letter/n/ea666f/32.png) [@nandakumar\_k\_6693](https://discuss.elastic.co/u/nandakumar_k_6693)\
**Post date:** [December 6, 2018, 12:11pm UTC](https://discuss.elastic.co/t/configure-mongodb-as-input-in-logstash-config-file/159724/1 "2018-12-06T12:11:52Z")

</div>

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](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?

---

<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:** [January 3, 2019, 12:11pm UTC](https://discuss.elastic.co/t/configure-mongodb-as-input-in-logstash-config-file/159724/2 "2019-01-03T12:11:58Z")

</div>

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