# How can I create 12h based index in logstash

**URL:** <https://discuss.elastic.co/t/how-can-i-create-12h-based-index-in-logstash/101287>\
**Category:** Logstash\
**Created:** [September 21, 2017, 8:37am UTC](https://discuss.elastic.co/t/how-can-i-create-12h-based-index-in-logstash/101287 "2017-09-21T08:37:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sanketdarji](https://avatars.discourse-cdn.com/v4/letter/s/76d3ee/32.png) [@sanketdarji](https://discuss.elastic.co/u/sanketdarji)\
**Post date:** [September 21, 2017, 8:37am UTC](https://discuss.elastic.co/t/how-can-i-create-12h-based-index-in-logstash/101287/1 "2017-09-21T08:37:43Z")

</div>

I want to create a 12h based logstash index.  
can you please let me know any way how can I achieve it?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [September 21, 2017, 8:50am UTC](https://discuss.elastic.co/t/how-can-i-create-12h-based-index-in-logstash/101287/2 "2017-09-21T08:50:40Z")

</div>

I haven't seen anyone do this, not sure it's possible with the date math it can do.

Why are you asking for it?

---

<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:** [September 24, 2017, 8:22pm UTC](https://discuss.elastic.co/t/how-can-i-create-12h-based-index-in-logstash/101287/3 "2017-09-24T20:22:00Z")

</div>

Using a date pattern like `YYYY.MM.dd.aa` in your elasticsearch output configuration's `index` option should work (you'll get "am" or "pm" to indicate which half of the day an event originated from).

---

<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 22, 2017, 8:22pm UTC](https://discuss.elastic.co/t/how-can-i-create-12h-based-index-in-logstash/101287/4 "2017-10-22T20:22:15Z")

</div>

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