索引清理和保留 Elastic Cloud
Index Cleanup and Retention Elastic Cloud
我很难找到明确的答案:Elastic Cloud (ELK Stack) 中的索引在删除前的默认保留时间是多少?是否可以轻松修改?我们最近从本地 ELK 堆栈迁移到云解决方案。以前我们用 Curator 做过这个。
我发现的最后一个 post 是从 2017 年开始的,据说云中不支持此功能:https://discuss.elastic.co/t/configure-retention-period-for-different-index/106491 这有变化吗?
我通过使用索引生命周期管理 (ILM) 和索引模板创建滚动来解决这个问题。大多数信息可以在这里找到:https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-rollover-index.html
然而它的要点是:
创建 ILM
使用滚动别名创建索引模板:
PUT _template/example-template-name
{
"index_patterns": [
"example-index-*"
],
"settings": {
"index": {
"lifecycle": {
"name": "name-of-lifecycle-created-earlier",
"rollover_alias": "example-index-name"
}
}
}
}
然后创建第一个具有翻转别名的索引。我个人使用滚动日期系统,URL 编码:
PUT /%3Cexample-index-name-%7Bnow%2Fd%7D-1%3E
{
"aliases": {
"example-index-name": {
"is_write_index" : true
}
}
}
在此之后只需写入别名,而不是索引本身。当满足 ILM 限制时,它将自动分配正确的索引和翻转。
我很难找到明确的答案:Elastic Cloud (ELK Stack) 中的索引在删除前的默认保留时间是多少?是否可以轻松修改?我们最近从本地 ELK 堆栈迁移到云解决方案。以前我们用 Curator 做过这个。
我发现的最后一个 post 是从 2017 年开始的,据说云中不支持此功能:https://discuss.elastic.co/t/configure-retention-period-for-different-index/106491 这有变化吗?
我通过使用索引生命周期管理 (ILM) 和索引模板创建滚动来解决这个问题。大多数信息可以在这里找到:https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-rollover-index.html
然而它的要点是:
创建 ILM
使用滚动别名创建索引模板:
PUT _template/example-template-name
{
"index_patterns": [
"example-index-*"
],
"settings": {
"index": {
"lifecycle": {
"name": "name-of-lifecycle-created-earlier",
"rollover_alias": "example-index-name"
}
}
}
}
然后创建第一个具有翻转别名的索引。我个人使用滚动日期系统,URL 编码:
PUT /%3Cexample-index-name-%7Bnow%2Fd%7D-1%3E
{
"aliases": {
"example-index-name": {
"is_write_index" : true
}
}
}
在此之后只需写入别名,而不是索引本身。当满足 ILM 限制时,它将自动分配正确的索引和翻转。