Delete old chunks from loki

Hello!
I configured deletion of old chunks via Table Manager. But the data is not deleted.
Now disk is full. Should I use a Compactor or is there something wrong in my config ?

auth_enabled: false

server:
  http_listen_port: 3100

ingester:
  lifecycler:
    address: 127.0.0.1
    ring:
      kvstore:
        store: inmemory
      replication_factor: 1
    final_sleep: 0s
  chunk_idle_period: 5m
  chunk_retain_period: 30s
  max_transfer_retries: 0

schema_config:
  configs:
    - from: 2018-04-15
      store: boltdb
      object_store: filesystem
      schema: v11
      index:
        prefix: index_
        period: 168h

storage_config:
  boltdb:
    directory: /data/loki/index

  filesystem:
    directory: /data/loki/chunks

limits_config:
  enforce_metric_name: false
  reject_old_samples: true
  reject_old_samples_max_age: 168h

chunk_store_config:
  max_look_back_period: 0s

table_manager:
  retention_deletes_enabled: true
  retention_period: 180d

Yes, I’d say use compactor instead, and disable table manager altogether.

1 Like

Thank you for your answer!
Will this be a working config if I want chunks to be deleted after 180 days?

auth_enabled: false

server:
  http_listen_port: 3100

ingester:
  lifecycler:
    address: 127.0.0.1
    ring:
      kvstore:
        store: inmemory
      replication_factor: 1
    final_sleep: 0s
  chunk_idle_period: 5m
  chunk_retain_period: 30s
  max_transfer_retries: 0

schema_config:
  configs:
    - from: 2018-04-15
      store: boltdb
      object_store: filesystem
      schema: v11
      index:
        prefix: index_
        period: 168h

storage_config:
  boltdb:
    directory: /data/loki/index

  filesystem:
    directory: /data/loki/chunks
	
compactor:
  working_directory: /data/loki/retention
  shared_store: filesystem
  retention_enabled: true
  retention_delete_delay: 2h
  retention_delete_worker_count: 150
  deletion_mode: filter-and-delete
  delete_request_cancel_period: 5m

limits_config:
  enforce_metric_name: false
  reject_old_samples: true
  reject_old_samples_max_age: 168h
  retention_period: 180d
  
chunk_store_config:
  max_look_back_period: 180d

#table_manager:
#  retention_deletes_enabled: true
#  retention_period: 180d

I think that looks good. I’d say test it in a dev environment real quick and make sure at least the compactor doesn’t complain about configuration.

1 Like