# How to EXPIRE a key in logstash?

**URL:** <https://discuss.elastic.co/t/how-to-expire-a-key-in-logstash/38320>\
**Category:** Logstash\
**Created:** [January 4, 2016, 2:44pm UTC](https://discuss.elastic.co/t/how-to-expire-a-key-in-logstash/38320 "2016-01-04T14:44:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![N\_M\_10](https://avatars.discourse-cdn.com/v4/letter/n/f19dbf/32.png) [@N\_M\_10](https://discuss.elastic.co/u/N_M_10)\
**Post date:** [January 4, 2016, 2:44pm UTC](https://discuss.elastic.co/t/how-to-expire-a-key-in-logstash/38320/1 "2016-01-04T14:44:38Z")

</div>

correct way of expiring a key in logstash

`input { http { host => "127.0.0.1" # default: 0.0.0.0 port => 31311 # default: 8080 } } output { redis { host => 'localhost' data_type => 'list' key => 'logstash:redis' EXPIRE => 'logstash:redis' '10' } }`

---

<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:** [January 4, 2016, 2:47pm UTC](https://discuss.elastic.co/t/how-to-expire-a-key-in-logstash/38320/2 "2016-01-04T14:47:58Z")

</div>

The redis output plugin doesn't support setting the key's expiration time.

---

<div class="post-metadata">

**Author:** ![N\_M\_10](https://avatars.discourse-cdn.com/v4/letter/n/f19dbf/32.png) [@N\_M\_10](https://discuss.elastic.co/u/N_M_10)\
**Post date:** [January 4, 2016, 3:02pm UTC](https://discuss.elastic.co/t/how-to-expire-a-key-in-logstash/38320/3 "2016-01-04T15:02:50Z")

</div>

I want to log events whenever they happen into redis, and this events will have expiry of lets say 1 hour, no of events per sec in high traffic conditions is 1300, so should i go with nginx under php or logstash ?

---

<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 6, 2017, 5:16am UTC](https://discuss.elastic.co/t/how-to-expire-a-key-in-logstash/38320/4 "2017-07-06T05:16:56Z")

</div>


