# Ensure delivery of events from SQL DB using logstash

**URL:** <https://discuss.elastic.co/t/ensure-delivery-of-events-from-sql-db-using-logstash/136398>\
**Category:** Logstash\
**Created:** [June 19, 2018, 2:48am UTC](https://discuss.elastic.co/t/ensure-delivery-of-events-from-sql-db-using-logstash/136398 "2018-06-19T02:48:52Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![kenneth](https://avatars.discourse-cdn.com/v4/letter/k/94ad74/32.png) [@kenneth](https://discuss.elastic.co/u/kenneth)\
**Post date:** [June 19, 2018, 2:48am UTC](https://discuss.elastic.co/t/ensure-delivery-of-events-from-sql-db-using-logstash/136398/1 "2018-06-19T02:48:52Z")

</div>

Hi,

I am currently using JDBC input in my logstash configuration. I would like to know what is the most simple setup or common approach to ensure that the records extracted from DB are delivered to Elastic? I am leaning towards persistent queues but if I understand correctly, persistent queues only applicable to inputs that uses a request-response protocol.

Regards  
Kenneth

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [June 19, 2018, 5:58am UTC](https://discuss.elastic.co/t/ensure-delivery-of-events-from-sql-db-using-logstash/136398/2 "2018-06-19T05:58:58Z")

</div>

If you enable the persistent queue you should be fine.

> I am leaning towards persistent queues but if I understand correctly, persistent queues only applicable to inputs that uses a request-response protocol.

What makes you think that?

---

<div class="post-metadata">

**Author:** ![kenneth](https://avatars.discourse-cdn.com/v4/letter/k/94ad74/32.png) [@kenneth](https://discuss.elastic.co/u/kenneth)\
**Post date:** [June 19, 2018, 10:37am UTC](https://discuss.elastic.co/t/ensure-delivery-of-events-from-sql-db-using-logstash/136398/3 "2018-06-19T10:37:08Z")

</div>

@magnusbaeck thanks for the reply. i thought jdbc input would not work with persistent.. maybe i was wrong.

however, tried it just now to ingest over 2 million rows but it seems not all rows were sent to elastic. should logstash be processing all events from the queue before shutting down?

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [June 19, 2018, 10:43am UTC](https://discuss.elastic.co/t/ensure-delivery-of-events-from-sql-db-using-logstash/136398/4 "2018-06-19T10:43:36Z")

</div>

Part of the point of the persistent queue is that Logstash won't have to wait for the queue to drain before shutting down since the queue will be available the next time it starts up.

---

<div class="post-metadata">

**Author:** ![kenneth](https://avatars.discourse-cdn.com/v4/letter/k/94ad74/32.png) [@kenneth](https://discuss.elastic.co/u/kenneth)\
**Post date:** [June 19, 2018, 10:49am UTC](https://discuss.elastic.co/t/ensure-delivery-of-events-from-sql-db-using-logstash/136398/5 "2018-06-19T10:49:59Z")

</div>

so if I need logstash to process all events at 1 go, i should set `queue.drain: true`, is that right?

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [June 19, 2018, 10:50am UTC](https://discuss.elastic.co/t/ensure-delivery-of-events-from-sql-db-using-logstash/136398/6 "2018-06-19T10:50:44Z")

</div>

Yes, that's how I interpret the documentation.

---

<div class="post-metadata">

**Author:** ![kenneth](https://avatars.discourse-cdn.com/v4/letter/k/94ad74/32.png) [@kenneth](https://discuss.elastic.co/u/kenneth)\
**Post date:** [June 22, 2018, 4:13am UTC](https://discuss.elastic.co/t/ensure-delivery-of-events-from-sql-db-using-logstash/136398/7 "2018-06-22T04:13:22Z")

</div>

Thanks @magnusbaeck. It works well when ingesting around 300K to 400K rows but with around 2 million records, its just slow and when i looked at the monitoring stats for logstash, events received/sent just doubled up.

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [June 24, 2018, 10:15am UTC](https://discuss.elastic.co/t/ensure-delivery-of-events-from-sql-db-using-logstash/136398/8 "2018-06-24T10:15:48Z")

</div>

Hmm. I'd look into the JVM heap situation.

---

<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 22, 2018, 10:15am UTC](https://discuss.elastic.co/t/ensure-delivery-of-events-from-sql-db-using-logstash/136398/9 "2018-07-22T10:15:49Z")

</div>

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