# Mongodb input plugin for logstash does not get any document

**URL:** <https://discuss.elastic.co/t/mongodb-input-plugin-for-logstash-does-not-get-any-document/109638>\
**Category:** Logstash\
**Created:** [November 29, 2017, 8:18pm UTC](https://discuss.elastic.co/t/mongodb-input-plugin-for-logstash-does-not-get-any-document/109638 "2017-11-29T20:18:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rgheleri](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rgheleri/32/18497_2.png) [@rgheleri](https://discuss.elastic.co/u/rgheleri)\
**Post date:** [November 29, 2017, 8:18pm UTC](https://discuss.elastic.co/t/mongodb-input-plugin-for-logstash-does-not-get-any-document/109638/1 "2017-11-29T20:18:52Z")

</div>

I'm trying to use Logstash to get data from Mongodb and insert into Elasticsearch, using the logstash-input-mongodb plugin. Aparently I can connect in mongo with success but no document is stored in elasticsearch, not even shows in stdout.

My conf file:

> ```
> input {
> mongodb {
> uri => 'mongodb://username:password@my-server-ip:27017/database'
> placeholder_db_dir => '/home/rodolpho/Documentos/Projetos/relatorios/temp'
> placeholder_db_name => 'logstash_sqlite.db'
> collection => 'sale_notifications'
> batch_size => 5000
> }
> }
> 
> output {
> elasticsearch { 
> hosts => "localhost:9200"
> index => "myIndex"
> document_id => "%{_id}"
> document_type => "myDocType"
> }
> stdout { codec => rubydebug }
> }
> 
> ```

My mongo collection:  
 ![Captura de tela de 2017-11-29 16-12-27](https://us1.discourse-cdn.com/elastic/original/3X/4/9/499c0cc61047d82a5fcb256e6c9b11d646951255.png)

Logstash response:

> [2017-11-29T15:58:26,802][INFO][logstash.agent] Successfully started Logstash API endpoint {:port=\>9600}  
> D, [2017-11-29T15:58:27.213000 #24740] DEBUG -- : MONGODB | my-server-ip:27017 | database.find | SUCCEEDED | 0.433s  
> D, [2017-11-29T15:58:27.229000 #24740] DEBUG -- : MONGODB | my-server-ip:27017 | database.find | STARTED | {"find"=\>"sale\_notifications", "filter"=\>{"\_id"=\>{"$gt"=\>BSON::ObjectId('5a12cb0100b15f0f6138e2f7')}}, "limit"=\>5000}  
> D, [2017-11-29T15:58:27.502000 #24740] DEBUG -- : MONGODB | my-server-ip:27017 | database.find | SUCCEEDED | 0.271s  
> D, [2017-11-29T15:58:27.515000 #24740] DEBUG -- : MONGODB | my-server-ip:27017 | database.listCollections | STARTED | {"listCollections"=\>1, "cursor"=\>{}, "filter"=\>{:name=\>{"$not"=\>/system.|$/}}}  
> D, [2017-11-29T15:58:27.702000 #24740] DEBUG -- : MONGODB | my-server-ip:27017 | database.listCollections | SUCCEEDED | 0.188s  
> D, [2017-11-29T15:58:27.758000 #24740] DEBUG -- : MONGODB | my-server-ip:27017 | database.find | STARTED | {"find"=\>"sale\_notifications", "filter"=\>{"\_id"=\>{"$gt"=\>BSON::ObjectId('5a1837a000b15f6cfc205669')}}, "limit"=\>5000}  
> D, [2017-11-29T15:58:28.040000 #24740] DEBUG -- : MONGODB | my-server-ip:27017 | database.find | SUCCEEDED | 0.281s  
> D, [2017-11-29T15:58:28.047000 #24740] DEBUG -- : MONGODB | my-server-ip:27017 | database.find | STARTED | {"find"=\>"sale\_notifications", "filter"=\>{"\_id"=\>{"$gt"=\>BSON::ObjectId('5a12cb0100b15f0f6138e2f7')}}, "limit"=\>5000}  
> D, [2017-11-29T15:58:28.441000 #24740] DEBUG -- : MONGODB | my-server-ip:27017 | database.find | SUCCEEDED | 0.394s  
> D, [2017-11-29T15:58:28.447000 #24740] DEBUG -- : MONGODB | my-server-ip:27017 | database.listCollections | STARTED | {"listCollections"=\>1, "cursor"=\>{}, "filter"=\>{:name=\>{"$not"=\>/system.|$/}}}  
> D, [2017-11-29T15:58:28.854000 #24740] DEBUG -- : MONGODB | my-server-ip:27017 | database.listCollections | SUCCEEDED | 0.405s

After a while, the execution doesn't end and not even elasticsearch index is created. Please, I really would appreciate any help.

Versions:

ES: 5.6.2  
Logstash: 5.6.2  
MongoDB: 3.2.8  
logstash-input-mongodb: 0.4.1

---

<div class="post-metadata">

**Author:** ![Zak\_Maq](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zak_maq/32/26014_2.png) [@Zak\_Maq](https://discuss.elastic.co/u/Zak_Maq)\
**Post date:** [December 27, 2017, 2:54pm UTC](https://discuss.elastic.co/t/mongodb-input-plugin-for-logstash-does-not-get-any-document/109638/2 "2017-12-27T14:54:01Z")

</div>

**Hi !** 😀  
**I have the same problem..**

**Did you find any solution ??**

**Thx**

---

<div class="post-metadata">

**Author:** ![rgheleri](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rgheleri/32/18497_2.png) [@rgheleri](https://discuss.elastic.co/u/rgheleri)\
**Post date:** [January 23, 2018, 5:39pm UTC](https://discuss.elastic.co/t/mongodb-input-plugin-for-logstash-does-not-get-any-document/109638/3 "2018-01-23T17:39:40Z")

</div>

Sorry, but no...

---

<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:** [February 20, 2018, 5:42pm UTC](https://discuss.elastic.co/t/mongodb-input-plugin-for-logstash-does-not-get-any-document/109638/4 "2018-02-20T17:42:32Z")

</div>

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