Vin*_*war 9 purge retention grafana-loki promtail
即使指定“retention_period: 12h”,“12h”旧日志也不会删除,因此我面临存储问题,因为日志不会删除。请帮我配置
loki:
enabled: true
isDefault: true
table_manager:
retention_deletes_enabled: true
retention_period: 12h
Run Code Online (Sandbox Code Playgroud)
我有以下与日志保留相关的配置:
...
compactor:
...
retention_enabled: true
...
limits_config:
...
retention_period: 90d
...
Run Code Online (Sandbox Code Playgroud)
在此处的文档中查看有关 Loki 配置的更多信息
默认情况下,当
table_manager.retention_deletes_enabled或compactor.retention_enabled标志未设置时,发送到 Loki 的日志将永远存在。
最短保留期限为24小时。
保留期必须是在块中配置的索引和块表的倍数。periodperiod_config
示例配置:
schema_config:
configs:
- from: 2020-10-24
store: boltdb-shipper
object_store: filesystem
schema: v11
index:
prefix: index_
period: 24h
table_manager:
retention_deletes_enabled: true
retention_period: 24h
Run Code Online (Sandbox Code Playgroud)
在 Grafana Loki 中设置保留的另一种方法是通过 Compactor。
limits_config:
retention_period: 168h
compactor:
working_directory: /data/retention
compaction_interval: 10m
retention_enabled: true
retention_delete_delay: 2h
retention_delete_worker_count: 150
schema_config:
configs:
- from: 2020-10-24
store: boltdb-shipper
object_store: filesystem
schema: v11
index:
prefix: index_
period: 24h
Run Code Online (Sandbox Code Playgroud)
请注意,仅当索引周期为 24h 时,保留才可用。
要立即清除数据,您可以将retention_delete_delay间隔设置为1m。这是一个延迟,在此之后块将在保留期间被完全删除。
更改配置后不要忘记重新启动 Loki:
systemctl restart loki
systemctl status loki
Run Code Online (Sandbox Code Playgroud)