# Create quarterly index in log stash config file

**URL:** <https://discuss.elastic.co/t/create-quarterly-index-in-log-stash-config-file/126521>\
**Category:** Logstash\
**Created:** [April 3, 2018, 8:24am UTC](https://discuss.elastic.co/t/create-quarterly-index-in-log-stash-config-file/126521 "2018-04-03T08:24:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![DILIP\_SHARMA](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dilip_sharma/32/42672_2.png) [@DILIP\_SHARMA](https://discuss.elastic.co/u/DILIP_SHARMA)\
**Post date:** [April 3, 2018, 8:24am UTC](https://discuss.elastic.co/t/create-quarterly-index-in-log-stash-config-file/126521/1 "2018-04-03T08:24:59Z")

</div>

hi  
there is any way to create quarterly index in logstash config file , i know how to create daily / monthly / year index , there is any function which can give quarter in log stash ,  
or we need to calculate that ?

Thanks

---

<div class="post-metadata">

**Author:** ![DILIP\_SHARMA](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dilip_sharma/32/42672_2.png) [@DILIP\_SHARMA](https://discuss.elastic.co/u/DILIP_SHARMA)\
**Post date:** [April 3, 2018, 5:04pm UTC](https://discuss.elastic.co/t/create-quarterly-index-in-log-stash-config-file/126521/2 "2018-04-03T17:04:47Z")

</div>

i able to solve

ruby {  
code =\> "  
event.set('quarter', Date.today.year.to\_s + '-' + ((Date.today.month / 3.0).ceil).to\_s)  
"  
}

and  
index =\> "logstash-%{quarter}"

---

<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:** [May 1, 2018, 5:04pm UTC](https://discuss.elastic.co/t/create-quarterly-index-in-log-stash-config-file/126521/3 "2018-05-01T17:04:59Z")

</div>

Closed on May 1, 2018, 5:04pm UTC

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