1. 修改 Curator 的配置文件
配置文件位置:在Kubesphere界面上如下图找到 elasticsearch-logging-curator-elasticsearch-curator-config , 并开始编辑。
如下图所示, 添加一个delete_indices 的action, filters使用正则前缀匹配, 匹配前缀为 “index”, 清理判断标准是创建超过36个小时, 修改后点击确定保存。
配置内容:
5:
action: delete_indices
description: "Clean all ecp indices"
options:
timeout_override:
continue_if_exception: False
disable_action: False
ignore_empty_list: True
filters:
- filtertype: pattern
kind: prefix
value: index
exclude: False
- filtertype: age
source: creation_date
direction: older
unit: hours
unit_count: 36
2. 修改 CronJob, 让 Curator 按想要的方式定时执行
如下图所以找到对应的 CronJob, 点击编辑YAML.
将箭头所示位置的执行时间改为每小时执行一次(默认是每天凌晨1点执行一次)。 点击确定保存。
如有必要, 也可以将kubesphere默认的日志采集对象index保留时间改短一点, 比如只保留一天。
3. 删掉不需要的日志采集
按下图找到kubesphere的日志采集CRD:input, 删掉不需要的日志采集对象。
如果不需要其他的日志采集, 可以只保留 tail-hostpath 一个采集目标。