I've set up an EFK stack on my Kubernetes cluster. I want to automatically delete indices after certain days later (i.e., log retention and rotation), so I've created an index lifecycle policy.
The policy's name is delete-after-60-days
, and after hot phase, it moves to delete phase when data is 60 days old.
I've also created an index template named delete-logstash
.
The index pattern is logstash-*
and below are rest of the settings:
{
"template": {
"settings": {
"index": {
"lifecycle": {
"name": "delete-after-60-days",
"rollover_alias": "logstash"
},
"routing": {
"allocation": {
"include": {
"_tier_preference": "data_content"
}
}
},
"number_of_shards": "1",
"number_of_replicas": "1"
}
},
"mappings": {},
"aliases": {}
}
}
My indices look like logstash-2023.06.01
, logstash-2023.06.02
, and so on, and I want to apply my index lifecycle policy to all the existing indices.
However, when I add lifecycle policy manually via Kibana UI, following error occurs:
illegal_argument_exception: index.lifecycle.rollover_alias [logstash] does not point to index [logstash-2023.06.01]
I think I should add alias to existing indices (and of course, automatically add alias to newly created indices), but I don't know how to do this in Kibana UI.
Also, I want to ensure that any newly created indices with matching patterns (logstash-*
) are correctly linked with and applied by the lifecycle policy.
Where am I doing wrong and where in the template or policy should I edit?
I would like to use Kibana UI to do this.
Thanks in advance.