# Rotate index every other day

**URL:** <https://discuss.elastic.co/t/rotate-index-every-other-day/42497>\
**Category:** Logstash\
**Created:** [February 23, 2016, 2:01pm UTC](https://discuss.elastic.co/t/rotate-index-every-other-day/42497 "2016-02-23T14:01:42Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Juan\_Andres\_Ramirez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/juan_andres_ramirez/32/9467_2.png) [@Juan\_Andres\_Ramirez](https://discuss.elastic.co/u/Juan_Andres_Ramirez)\
**Post date:** [February 23, 2016, 2:01pm UTC](https://discuss.elastic.co/t/rotate-index-every-other-day/42497/1 "2016-02-23T14:01:42Z")

</div>

Hello Guys,  
I'm using logstash 2.2, in a Centos 6. Logstash rotates the indices each day, is there any way to rotate index every 2 days or 3 days?. Or rotate the index by size?. I must save and keep open the index by 6 months. I want to create a new index with max size in 45GB.

Thank you.

---

<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:** [February 23, 2016, 6:45pm UTC](https://discuss.elastic.co/t/rotate-index-every-other-day/42497/2 "2016-02-23T18:45:20Z")

</div>

You currently cannot do this natively, you'd have to build a process to monitor the time/size and then roll the index.

---

<div class="post-metadata">

**Author:** ![Juan\_Andres\_Ramirez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/juan_andres_ramirez/32/9467_2.png) [@Juan\_Andres\_Ramirez](https://discuss.elastic.co/u/Juan_Andres_Ramirez)\
**Post date:** [February 23, 2016, 7:04pm UTC](https://discuss.elastic.co/t/rotate-index-every-other-day/42497/3 "2016-02-23T19:04:03Z")

</div>

Hey Markolm  
Understood, thank you.

---

<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:** [February 23, 2016, 10:06pm UTC](https://discuss.elastic.co/t/rotate-index-every-other-day/42497/4 "2016-02-23T22:06:46Z")

</div>

A way to do this is by having an alias for the index you are writing into and use this in Logstash. You can then roll indices in the background through a script based on age and/or size. When the index being written to reaches the point when it should be rolled, create the next index and then switch the alias to point to the new index.

---

<div class="post-metadata">

**Author:** ![Juan\_Andres\_Ramirez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/juan_andres_ramirez/32/9467_2.png) [@Juan\_Andres\_Ramirez](https://discuss.elastic.co/u/Juan_Andres_Ramirez)\
**Post date:** [February 25, 2016, 3:20pm UTC](https://discuss.elastic.co/t/rotate-index-every-other-day/42497/5 "2016-02-25T15:20:26Z")

</div>

ok, Thanks Christian.

---

<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:09am UTC](https://discuss.elastic.co/t/rotate-index-every-other-day/42497/6 "2017-07-06T05:09:45Z")

</div>


