# Logstash and MongoDB using logstash-input-mongodb

**URL:** <https://discuss.elastic.co/t/logstash-and-mongodb-using-logstash-input-mongodb/62081>\
**Category:** Logstash\
**Created:** [October 3, 2016, 2:31pm UTC](https://discuss.elastic.co/t/logstash-and-mongodb-using-logstash-input-mongodb/62081 "2016-10-03T14:31:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![DooGZ](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/doogz/32/12272_2.png) [@DooGZ](https://discuss.elastic.co/u/DooGZ)\
**Post date:** [October 3, 2016, 2:31pm UTC](https://discuss.elastic.co/t/logstash-and-mongodb-using-logstash-input-mongodb/62081/1 "2016-10-03T14:31:55Z")

</div>

Hi,

tried using the unofficial logstash-input-mongodb, but im having problem importing MongoDB to ES.  
Is there something that I am missing in the config file? TIA  
MongoDB Name: test  
Table: restaurants

Configuration:  
input {  
mongodb {  
uri =\> 'mongodb://user:pass@192.168.1.50:27017/test'  
placeholder\_db\_dir =\> '/opt/logstash-mongodb/'  
placeholder\_db\_name =\> 'logstash\_sqlite.db'  
collection =\> '/restaurants/'  
batch\_size =\> 5000  
}  
}

output {  
elasticsearch {  
hosts =\> "localhost:9200"  
index =\> "restaurants"  
document\_type =\> "restaurant"  
document\_id =\> "%{restaurant\_id}"  
manage\_template =\> true  
}  
stdout { codec =\> rubydebug }  
}

This is what I got:

logstash-2.4.0\bin\>logstash -w8 -f mongodb.conf  
Settings: User set pipeline workers: 8, Default pipeline workers: 4  
D, [2016-10-03T07:23:26.095000 #12324] DEBUG -- : MONGODB | Adding 192.168.1.50:  
27017 to the cluster. | runtime: 0.0000ms  
D, [2016-10-03T07:23:26.124000 #12324] DEBUG -- : MONGODB | COMMAND | namespace=  
admin.$cmd selector={:ismaster=\>1} flags=[] limit=-1 skip=0 project=nil | runtim  
e: 27.0000ms  
D, [2016-10-03T07:23:26.231000 #12324] DEBUG -- : MONGODB | COMMAND | namespace=  
test.$cmd selector={:saslStart=\>1, :autoAuthorize=\>1, :payload=\>\<BSON::Binary:0x  
13480 type=generic data=0x6e2c2c6e3d746573...\>, :mechanism=\>"SCRAM-SHA-1"} flags  
=[] limit=-1 skip=0 project=nil | runtime: 4.9999ms  
D, [2016-10-03T07:23:26.306000 #12324] DEBUG -- : MONGODB | COMMAND | namespace=  
test.$cmd selector={:saslContinue=\>1, :payload=\>\<BSON::Binary:0x13482 type=gener  
ic data=0x633d626977732c72...\>, :conversationId=\>1} flags=[] limit=-1 skip=0 pro  
ject=nil | runtime: 6.0000ms  
D, [2016-10-03T07:23:26.315000 #12324] DEBUG -- : MONGODB | COMMAND | namespace=  
test.$cmd selector={:saslContinue=\>1, :payload=\>\<BSON::Binary:0x13484 type=gener  
ic data=0x...\>, :conversationId=\>1} flags=[] limit=-1 skip=0 project=nil | runti  
me: 5.9998ms  
D, [2016-10-03T07:23:26.322000 #12324] DEBUG -- : MONGODB | COMMAND | namespace=  
test.$cmd selector={:listCollections=\>1, :cursor=\>{}, :filter=\>{:name=\>{"$not"=\>  
/system.|$/}}} flags=[:slave\_ok] limit=-1 skip=0 project=nil | runtime: 99.000  
2ms  
D, [2016-10-03T07:23:26.348000 #12324] DEBUG -- : MONGODB | COMMAND | namespace=  
test.$cmd selector={:listCollections=\>1, :cursor=\>{}, :filter=\>{:name=\>{"$not"=\>  
/system.|$/}}} flags=[:slave\_ok] limit=-1 skip=0 project=nil | runtime: 17.000  
0ms  
D, [2016-10-03T07:23:26.385000 #12324] DEBUG -- : MONGODB | COMMAND | namespace=  
test.$cmd selector={:listCollections=\>1, :cursor=\>{}, :filter=\>{:name=\>{"$not"=\>  
/system.|$/}}} flags=[:slave\_ok] limit=-1 skip=0 project=nil | runtime: 10.999  
9ms  
D, [2016-10-03T07:23:26.436000 #12324] DEBUG -- : MONGODB | COMMAND | namespace=  
test.$cmd selector={:listCollections=\>1, :cursor=\>{}, :filter=\>{:name=\>{"$not"=\>  
/system.|$/}}} flags=[:slave\_ok] limit=-1 skip=0 project=nil | runtime: 9.0001  
ms  
D, [2016-10-03T07:23:26.530000 #12324] DEBUG -- : MONGODB | COMMAND | namespace=  
test.$cmd selector={:listCollections=\>1, :cursor=\>{}, :filter=\>{:name=\>{"$not"=\>  
/system.|$/}}} flags=[:slave\_ok] limit=-1 skip=0 project=nil | runtime: 10.000  
0ms  
D, [2016-10-03T07:23:26.702000 #12324] DEBUG -- : MONGODB | COMMAND | namespace=  
test.$cmd selector={:listCollections=\>1, :cursor=\>{}, :filter=\>{:name=\>{"$not"=\>  
/system.|$/}}} flags=[:slave\_ok] limit=-1 skip=0 project=nil | runtime: 7.0000  
ms  
D, [2016-10-03T07:23:27.034000 #12324] DEBUG -- : MONGODB | COMMAND | namespace=  
test.$cmd selector={:listCollections=\>1, :cursor=\>{}, :filter=\>{:name=\>{"$not"=\>  
/system.|$/}}} flags=[:slave\_ok] limit=-1 skip=0 project=nil | runtime: 7.9999  
ms  
Pipeline main started  
D, [2016-10-03T07:23:27.682000 #12324] DEBUG -- : MONGODB | COMMAND | namespace=  
test.$cmd selector={:listCollections=\>1, :cursor=\>{}, :filter=\>{:name=\>{"$not"=\>  
/system.|$/}}} flags=[:slave\_ok] limit=-1 skip=0 project=nil | runtime: 5.9998  
ms  
D, [2016-10-03T07:23:28.970000 #12324] DEBUG -- : MONGODB | COMMAND | namespace=  
test.$cmd selector={:listCollections=\>1, :cursor=\>{}, :filter=\>{:name=\>{"$not"=\>  
/system.|$/}}} flags=[:slave\_ok] limit=-1 skip=0 project=nil | runtime: 5.0001  
ms  
D, [2016-10-03T07:23:31.537000 #12324] DEBUG -- : MONGODB | COMMAND | namespace=  
test.$cmd selector={:listCollections=\>1, :cursor=\>{}, :filter=\>{:name=\>{"$not"=\>  
/system.|$/}}} flags=[:slave\_ok] limit=-1 skip=0 project=nil | runtime: 5.0001  
ms  
D, [2016-10-03T07:23:36.135000 #12324] DEBUG -- : MONGODB | COMMAND | namespace=  
admin.$cmd selector={:ismaster=\>1} flags=[] limit=-1 skip=0 project=nil | runtim  
e: 7.0000ms  
D, [2016-10-03T07:23:36.546000 #12324] DEBUG -- : MONGODB | COMMAND | namespace=  
test.$cmd selector={:listCollections=\>1, :cursor=\>{}, :filter=\>{:name=\>{"$not"=\>  
/system.|$/}}} flags=[:slave\_ok] limit=-1 skip=0 project=nil | runtime: 5.0001  
ms

---

<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:** [July 6, 2017, 4:36am UTC](https://discuss.elastic.co/t/logstash-and-mongodb-using-logstash-input-mongodb/62081/2 "2017-07-06T04:36:04Z")

</div>


