[英]why my Loki log retention is not working?
“12h”舊日志即使在指定“retention_period: 12h”后也不會刪除,因此我面臨存儲問題,因為日志不會刪除。 請幫我配置
loki:
enabled: true
isDefault: true
table_manager:
retention_deletes_enabled: true
retention_period: 12h
我有以下與日志保留相關的配置:
...
compactor:
...
retention_enabled: true
...
limits_config:
...
retention_period: 90d
...
在此處的文檔中查看有關 Loki 配置的更多信息
來自Grafana 存儲文檔:
除了文件系統塊存儲外,Loki 不會刪除舊的塊存儲。 這通常是通過在您選擇的塊存儲中配置 TTL(生存時間)來處理的(S3/GCS 中的存儲桶生命周期,以及 Cassandra 中的 TTL)。 當使用文件系統塊存儲時本地磁盤已滿時,Loki 目前也不會刪除舊數據——刪除僅由保留期限決定。
這句話應該回答你的問題。 您需要在存儲提供程序中配置存儲桶生命周期才能刪除塊存儲。
默認情況下,當
table_manager.retention_deletes_enabled
或compactor.retention_enabled
標志未設置時,發送到 Loki 的日志將永遠存在。
最短保留期為 24 小時。
保留期必須是索引和塊表period
的倍數,在period_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
在 Grafana Loki 中設置保留的另一種方法是通過 Compactor。
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
請注意,保留僅在索引周期為 24 小時時可用。
要立即清除數據,您可以將retention_delete_delay
間隔設置為1m
。 這是一個延遲,之后塊將在保留期間被完全刪除。
更改配置后不要忘記重啟 Loki:
systemctl restart loki
systemctl status loki
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.