# Logstash output to create an index based on 2 hour data

**URL:** <https://discuss.elastic.co/t/logstash-output-to-create-an-index-based-on-2-hour-data/201729>\
**Category:** Logstash\
**Created:** [October 1, 2019, 6:00am UTC](https://discuss.elastic.co/t/logstash-output-to-create-an-index-based-on-2-hour-data/201729 "2019-10-01T06:00:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bob94](https://avatars.discourse-cdn.com/v4/letter/b/c89c15/32.png) [@Bob94](https://discuss.elastic.co/u/Bob94)\
**Post date:** [October 1, 2019, 6:00am UTC](https://discuss.elastic.co/t/logstash-output-to-create-an-index-based-on-2-hour-data/201729/1 "2019-10-01T06:00:51Z")

</div>

Hi,  
Is there in any way i can create an index from logstash output and segregate the index based on 2 hours index ?

%{+yyyy.mm.dd.hh} will create the data in every hour...what i need is in every 2 hour..

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [October 1, 2019, 6:46am UTC](https://discuss.elastic.co/t/logstash-output-to-create-an-index-based-on-2-hour-data/201729/2 "2019-10-01T06:46:54Z")

</div>

Why do you want to do this? Do you have an extremely high ingest rate or a very short retention period? This kind of scheme can easily result in very large number of indices and shards which can be very inefficient. That said I do not think there is any built in support for this so you may need to calculate the hour in the config and add it separately to the index pattern.

---

<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 29, 2019, 6:46am UTC](https://discuss.elastic.co/t/logstash-output-to-create-an-index-based-on-2-hour-data/201729/3 "2019-10-29T06:46:55Z")

</div>

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