I have a simple policy for index rollover every day (or every 1gb). I use an index template -> index pattern->index alias (see bellow).
However it does not seem to rotate. Any ideas why (or how to test it? E.g if I send _rollover to the index_alias will that force the rotation even if the requirements are not met?)
Here is how I created it:
- I first pointed logstash to the alias: index_from_logstash_test_alias
- I created the index template: index_template (with index pattern index_from_logstash_test_alias* )
- Bootstrap index with
Bootstrap index:
PUT index_from_logstash_test_alias-000001
{
"aliases": {
"index_from_logstash_test_alias": {
"is_write_index": true
}
}
}
Some more info if needed:
PUT _index_template/test_template
{
"template": {
"settings": {
"index": {
"lifecycle": {
"name": "testindexpolicy",
"rollover_alias": "index_from_logstash_test_alias"
},
"number_of_replicas": "0"
}
},
"mappings": {
"properties": {
"@version": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"@timestamp": {
"type": "date"
},
"app_server": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"app_server2": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
},
"aliases": {
"test-search-all": {}
}
},
"index_patterns": [
"index_from_logstash_test_alias*"
]
}
And the policy:
{
"testindexpolicy" : {
"version" : 1,
"modified_date" : "2023-03-17T12:08:04.639Z",
"policy" : {
"phases" : {
"hot" : {
"min_age" : "0ms",
"actions" : {
"set_priority" : {
"priority" : 100
},
"rollover" : {
"max_primary_shard_size" : "1gb",
"max_age" : "1d"
}
}
}
}
},
"in_use_by" : {
"indices" : [ ],
"data_streams" : [ ],
"composable_templates" : [
"test_template"
]
}