My indexes are created from a template as ‘name-year.month.date’. It seems that this isn’t acceptable for index-lifecycle-policies anymore. I get this error “index name [name-2025.12.09] does not match pattern '^.*-\d+$'“.
At one point this process was working. I was able to rollover/delete indexes based on age.
That regular expression pattern does as far as I can see not appear to match the index name so I would recommend fixing the pattern. (You need to account for the dots in the date) If this at some point has worked that must have been a bug that has been fixed.
There are 2 things related to date pattern indices.
The first is when indices roll over, many have their birthdate in the name. This is still done by many of the Elastic provided integrations.
The second type is where the date from the event is used in the index name. That causes a new index to be created daily. That can lead to a lot of smaller indices, which can cause problems. Another problem that can happen is a new beats/agent starts harvesting host logs that go back for years and the config doesn’t block the older events (I don’t remember the parameter). If you have 2 years of data, you can suddenly create 720 new indices. (I’ve done it, not fun)
I need them to rollover daily. Beats create a large amount of data and I need to be able to prune it by date on the regular. This is what I was trying to achieve with the index-lifecycle.
For the regex pattern I think something like ^.*-[\d\.]+$ might work, but I have not tested it. That pattern should look for a sequence of dots and digits to end the index name.
How many different time based indices are you creating?
This will delete the index after 7 days of the creation.
If you want to have the dates on the index name, it will add some more complications, first data streams require rollover by size or age, you will not have daily indices anymore, also the date of the backing index will be the date when it rolled over.
Even if you rollover every 24 hours, it is counted by age, not like logstash that creates a new index when the day changes.
Another issue is that if you use custom naming, Logstash per default does not support writing data to custom data streams, it would require your indices to start with logs-* for example, which forces you to be careful with the template because there is a built-in template that would match logs-*.
You can have custom data streams names with Logstash, I have some, but you need to use an output like this:
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.