actions:
1:
action: rollover
description: >-
Rollover the index associated with alias 'aliasname', which should be in the
form of prefix-000001 (or similar), or prefix-YYYY.MM.DD-1.
options:
name: logsservices
conditions:
max_age: 1d
max_docs: 1000000
extra_settings:
index.number_of_shards: 5
index.number_of_replicas: 1
However, at next day I get this on log:
//2018-04-18 12:00:17,880 DEBUG elasticsearch log_request_success:86 < {"old_index":"logsservices-2018.04.17-1","new_index":"logsservices-2018.04.17-000002","rolled_over":true,"dry_run":false,"acknowledged":true,"shards_acknowledged":true,"conditions":{"[max_docs: 1000000]":false,"[max_age: 1d]":true}}
and created a new index with name "logsservices-2018.04.17-000002" instead of "logsservices-2018.04.18-1"
what am I making wrong? How is the correct configuration?
I took the liberty of editing your post to make it legible. Please use the code tags or triple back-ticks to encapsulate preformatted text in the future.
First, you can create the index and the alias in one shot:
PUT /logservices-2018.04.17-1
{
"aliases": {
"logservices": {}
}
}
Second, there is an undocumented feature for the rollover action that lets you name a new index:
On a separate note, why even both with dated indices if you're using rollover? You can still use Curator's other age filter options (i.e. field stats) to calculate the index age without needing the index to have a timestamp in the index name. You're generally better off letting the index grow to 5+ GB per shard before rolling over anyway, as smaller than that is just wasted resources.
I heavily advocate just naming the indices logservices-000001 and rolling over to just the next number.
Great!! I like this solution but I have a question.
I'm thinking use delete_indices action for delete older logs and the Elasticsearch version is 6.2. Should I use field_caps or field_stats on filter age to get field @timestamp?
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.