# Mongodb logstash data input

**URL:** <https://discuss.elastic.co/t/mongodb-logstash-data-input/329830>\
**Category:** Logstash\
**Created:** [April 12, 2023, 11:49am UTC](https://discuss.elastic.co/t/mongodb-logstash-data-input/329830 "2023-04-12T11:49:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jskang](https://avatars.discourse-cdn.com/v4/letter/j/c2a13f/32.png) [@jskang](https://discuss.elastic.co/u/jskang)\
**Post date:** [April 12, 2023, 11:49am UTC](https://discuss.elastic.co/t/mongodb-logstash-data-input/329830/1 "2023-04-12T11:49:13Z")

</div>

hello.  
After struggling for days, I finally connected mongodb and logstash.  
But another problem arose.  
I want to send only newly entered logs to the index using sql\_last\_value, but it doesn't work.  
Is this impossible in Logstash?  
Is there any other way?  
statement =\> "db.t\_log.find({Stamp:{$gt:sql\_last\_value }},{\_id:0}).pretty()"

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [April 12, 2023, 3:39pm UTC](https://discuss.elastic.co/t/mongodb-logstash-data-input/329830/2 "2023-04-12T15:39:39Z")

</div>

If you are using the mongodb input then no, it is not possible. It does not support sql\_last\_value. It expects to read every item in a collection except the first, and keeps track in its own sincedb. The first entry is consumed whilst initializing the sincedb and never returned to logstash.

---

<div class="post-metadata">

**Author:** ![jskang](https://avatars.discourse-cdn.com/v4/letter/j/c2a13f/32.png) [@jskang](https://discuss.elastic.co/u/jskang)\
**Post date:** [April 13, 2023, 5:34am UTC](https://discuss.elastic.co/t/mongodb-logstash-data-input/329830/3 "2023-04-13T05:34:09Z")

</div>

hello.  
thank you for the reply.  
I looked up sincedb and it seems to be related to file. I am currently using jdbc among input-plugins. How can I synchronize mongodb data with elasticsearch when using jdbc?  
is it impossible?

---

<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:** [May 11, 2023, 5:34am UTC](https://discuss.elastic.co/t/mongodb-logstash-data-input/329830/4 "2023-05-11T05:34:23Z")

</div>

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