表管理器不会清除 loki 2.4 中的块

Bap*_*ias 3 purge retention grafana-loki

我想删除超过 31 天的块数据,所以我做了这样的配置

schema_config:
  configs:
    - from: 2020-10-24
      store: boltdb-shipper
      object_store: filesystem
      schema: v11
      index:
        prefix: index_
        period: 24h

storage_config:
  boltdb_shipper:
    active_index_directory: "/var/lib/loki/boltdb-shipper-active"
    cache_location: "/var/lib/loki/boltdb-shipper-cache"
    cache_ttl: 24h 
    shared_store: filesystem
  filesystem:
    directory: /var/lib/loki/chunks

chunk_store_config:
  max_look_back_period: 0s

table_manager:
  retention_deletes_enabled: true
  retention_period: 31d
Run Code Online (Sandbox Code Playgroud)

但实际上删除从未发生过。

我是否忘记了配置中的某些内容?

洛基版本:2.4.1

Mar*_*ira 7

我不确定这是否是您的情况,但从 Loki 2.4.0 开始,单个二进制文件不再运行表管理器,这会影响以下场景中的任何人:

  1. 使用除boltdb-shipper或boltdb之外的任何索引类型运行单个二进制Loki
  2. 依靠配置retention_deletes_enabled和retention_period的保留

请参阅此处的 Loki 升级指南,了解更多信息以及如何解决此问题。


小智 7

Grafana Loki 中的保留是通过表管理器Compactor实现的。在您的情况下,boltdb-shipper 用于索引和块。对于本地存储而言,表管理器并不是一个很好的选择。

Compactor 保留将成为默认设置并获得长期支持。它支持针对每个租户和每个流用例的更细粒度的保留策略。

请查看此处的指南

compactor:
  retention_enabled: true
  retention_delete_delay: 2h <amount of hours to delay the retention period>
  retention_delete_worker_count: 150
limits_config:
  retention_period: [30d]
Run Code Online (Sandbox Code Playgroud)