Index rollover with date and time

Hi Community!

I'm trying to create an index rollover with the date and hour when the new index is created because I set up the rollover every hour during the day. Having this in consideration, the format of the new index should be:

my-index-2021.09.06.14-000001

Is there a way to do this? I tried using date math and returns just the date:

PUT %3Cmy-index-%7Bnow%2Fd%7D-000001%3E

Also tried this, and it doesn't gives the actual time.

PUT /%3Cmy-index-%7Bnow%2Fd%7BYYYY.MM.dd.HH.mm%7D%7D%3E

Thank you very much!

Hey,

I just tried

curl -X PUT 'localhost:9200/<logstash-%7Bnow%7Byyyy.MM.dd-HH.mm%7D%7D>'

which does not do any now/d tricks, because that will always mean the start of the day, if you use hours and minutes.

Does that help?

so you can't timestamp the time of the new index rollover?

For example,

my-index-2021.09.06.14.14.00-000001
my-index-2021.09.06.14.15.00-000001
my-index-2021.09.06.14.16.00-000001
etc...

thanks!

Have you tried the above example? If not, do :slight_smile:

That said, I hope you do not aim for indices by the minute and this is just to keep the creation date in the index name :slight_smile:

Thank you very much! It worked! :slight_smile:

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