ElasticSearch Curator 删除除非最后一个条目
ElasticSearch Curator delete unless last entry
有没有办法阻止馆长在按时间删除时删除最后一个索引?
actions:
1:
action: delete_indices
description: Delete kube- indices older than 14 days. Ignore the error if there are none and exit cleanly.
options:
disable_action: False
ignore_empty_list: True
filters:
- filtertype: pattern
kind: prefix
value: kube-
- filtertype: age
source: name
direction: older
timestring: '%Y.%m.%d'
unit: days
unit_count: 14
我有这个非常适合检查当前 运行 K8s 集群日志。但是,当我们移动 AWS 区域时,日志名称会发生变化,例如从 kube-eu-west-1-<date>
到 kube-eu-west-2-<date>
.
Curator 在 14 天后努力清理所有数据。我想要的是防止它删除特定索引的最后一个条目,所以总是有关于集群最后一次在该区域发生的事情的记录。
(它还会 "fix" 一些编写得不太好的代码片段,当他们期望存在的数据合法消失时会抛出错误)。
您可以使用 count
filter:
filters:
# your existing filters go BEFORE the count filter...
- filtertype: count
count: 1
此示例应从可操作索引列表中排除(尽管 exclude: false
)最新索引,并保留它。如果这不是您要排除的索引,请使用 exclude: true/false
(默认为 true
)、and/or reverse: true/false
(默认为 true
)进行探索,直到排除你想要的索引。
注意: 在将过滤器部署到实际数据之前,始终使用 --dry-run
标志来测试过滤器。迭代直到它看起来正确。如果有帮助,在您的客户端设置中使用 loglevel: DEBUG
将显示过滤器如何做出决定。
有没有办法阻止馆长在按时间删除时删除最后一个索引?
actions:
1:
action: delete_indices
description: Delete kube- indices older than 14 days. Ignore the error if there are none and exit cleanly.
options:
disable_action: False
ignore_empty_list: True
filters:
- filtertype: pattern
kind: prefix
value: kube-
- filtertype: age
source: name
direction: older
timestring: '%Y.%m.%d'
unit: days
unit_count: 14
我有这个非常适合检查当前 运行 K8s 集群日志。但是,当我们移动 AWS 区域时,日志名称会发生变化,例如从 kube-eu-west-1-<date>
到 kube-eu-west-2-<date>
.
Curator 在 14 天后努力清理所有数据。我想要的是防止它删除特定索引的最后一个条目,所以总是有关于集群最后一次在该区域发生的事情的记录。
(它还会 "fix" 一些编写得不太好的代码片段,当他们期望存在的数据合法消失时会抛出错误)。
您可以使用 count
filter:
filters:
# your existing filters go BEFORE the count filter...
- filtertype: count
count: 1
此示例应从可操作索引列表中排除(尽管 exclude: false
)最新索引,并保留它。如果这不是您要排除的索引,请使用 exclude: true/false
(默认为 true
)、and/or reverse: true/false
(默认为 true
)进行探索,直到排除你想要的索引。
注意: 在将过滤器部署到实际数据之前,始终使用 --dry-run
标志来测试过滤器。迭代直到它看起来正确。如果有帮助,在您的客户端设置中使用 loglevel: DEBUG
将显示过滤器如何做出决定。