# Persistent queue not fully emptied after ES output unavailable

**URL:** <https://discuss.elastic.co/t/persistent-queue-not-fully-emptied-after-es-output-unavailable/192445>\
**Category:** Logstash\
**Created:** [July 26, 2019, 1:06pm UTC](https://discuss.elastic.co/t/persistent-queue-not-fully-emptied-after-es-output-unavailable/192445 "2019-07-26T13:06:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rbayet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rbayet/32/51965_2.png) [@rbayet](https://discuss.elastic.co/u/rbayet)\
**Post date:** [July 26, 2019, 1:06pm UTC](https://discuss.elastic.co/t/persistent-queue-not-fully-emptied-after-es-output-unavailable/192445/1 "2019-07-26T13:06:08Z")

</div>

Hi,

I have a setup with a JMS input which subs to a durable topic on a message broker.  
Events contain log data in JSON format, so in my filters, I have a json, split and a bit of ruby code.  
The single output is ES.  
At the moment, I'm running test where I push 5K messages in the broker, each message contain 50 log lines, for a jms input of 5K message, I'm outputing 250K documents in ES.

As the log data is expected to be kept for long time usage, I activated the queue persistence to avoid data loss when ES is down / unavailable.  
Starting from a situation where everything is up but there is no broker activity, I shutdown ES, let Logstash complain a bit about that, then push my 5K messages on the broker.  
I can clearly see the pages being created on disk and the message disappearing from the broker's topic and when I start ES again, documents are correctly indexed... **but** if there is no other activity on the broker, there are always some message _stuck_ in the persisted queue.

I know they are there because :

- I don't reach the full 250K amount of indexed documents
- the queue page size on disk is a few MB
- if I restart logstash, the queue will end up being drained (after the restart and not during the stop - since `queue.drained` is still set to false I suppose)

What's even more puzzling is that even if I don't forcefully interrupt ElasticSearch, on a "clean state" pipeline, if I push another batch of 5K jms messages (reminder: it's supposed to generate 5K\*50 = 250K documents), at most 40K documents will be indexed.  
Which means at most 800 jms messages have been fully acked and processed and the rest is stucked in the ~50MB queue on disk.

Am I missing something ?  
Have I totally misunderstood what the persistence queue is about ?

PS: I haven't changed any `pipeline` or `queue` settings except `queue.type` to `persisted`.

Regards,  
R.

---

<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:** [August 23, 2019, 1:06pm UTC](https://discuss.elastic.co/t/persistent-queue-not-fully-emptied-after-es-output-unavailable/192445/2 "2019-08-23T13:06:11Z")

</div>

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