我很难找到一个明确的答案:在Elastic Cloud(ELK Stack)中删除索引之前的默认保留时间是多少,可以轻松修改吗?我们最近已从本地ELK堆栈迁移到云解决方案。以前,我们是通过Curator做到这一点的。

我发现的最后一篇帖子来自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限制时,它将自动分配正确的索引和翻转。

关于elasticsearch - 索引清理和保留弹性云,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/58659891/

10-17 03:03