# Feature: max\_age of events in persistent queue / time based cleanup

**URL:** https://discuss.elastic.co/t/feature-max-age-of-events-in-persistent-queue-time-based-cleanup/147367
**Category:** Logstash
**Created:** [September 5, 2018, 10:20am UTC](https://discuss.elastic.co/t/feature-max-age-of-events-in-persistent-queue-time-based-cleanup/147367 "2018-09-05T10:20:37Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Suny](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/suny/32/22082_2.png) [@Suny](https://discuss.elastic.co/u/Suny)
#### Post date: [September 5, 2018, 10:20am UTC](https://discuss.elastic.co/t/feature-max-age-of-events-in-persistent-queue-time-based-cleanup/147367/1 "2018-09-05T10:20:37Z")

</div>

The persistent queue can be configured to hold a specific number of events, and it can be limited in size (see [persistent queue doc](https://www.elastic.co/guide/en/logstash/current/persistent-queues.html#configuring-persistent-queues)) , the parameters are called `queue.max_events` and `queue.max_bytes`. Due to regulations, we have to ensure that we do not store events older than x minutes. It would be great to have an age-based cleanup, and a parameter `queue.max_age`. It would be good enough to use the timestamp of the event when it entered the queue.

One workaround idea that a collegue came up with is to delete the queue pages on disk after x minutes. But we didn't test how logstash would take that.

The information of how much time the event spent in logstash seems to exist in `duration_in_millis` , but I'm not sure when exactly that starts and stops.

---

<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: [October 3, 2018, 10:20am UTC](https://discuss.elastic.co/t/feature-max-age-of-events-in-persistent-queue-time-based-cleanup/147367/2 "2018-10-03T10:20:40Z")

</div>

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