Delete Logs in Grafana Loki (free edition) with Minio as S3 storage

How can I delete Logs from Loki older than x days? I tried to set all the retention attributes I could find on the web without success. Logs are either not deleted at all or completely deleted. We use the loki image “grafana/loki:2.5.0” and the minio image “minio/minio:RELEASE.2022-07-17T15-43-14Z” in docker-compose.
Below find my trial set the rentention period to 24h.Are Logs deleted on loki level or on minio/S3-Bucket level?

auth_enabled: false

server:
  http_listen_port: 3200

distributor:
  ring:
    kvstore:
      store: memberlist

ingester:
  lifecycler:
    ring:
      kvstore:
        store: memberlist
      replication_factor: 1
    final_sleep: 0s
  chunk_idle_period: 30s
  chunk_retain_period: 30s
  wal:
    # Some trials  write logs from filesystem to s3 faster than 5 minutes
    checkpoint_duration: 30s
    enabled: true
    dir: /loki/wal

memberlist:
  abort_if_cluster_join_fails: false

  # Expose this port on all distributor, ingester
  # and querier replicas.
  bind_port: 7946

  # You can use a headless k8s service for all distributor,
  # ingester and querier components.
  join_members:
    - loki:7946

  max_join_backoff: 1m
  max_join_retries: 10
  min_join_backoff: 1s

schema_config:
  configs:
    - from: 2020-05-15
      store: boltdb-shipper
      object_store: s3
      schema: v11
      index:
        prefix: index_
        period: 24h

storage_config:
  boltdb_shipper:
    active_index_directory: /loki/index
    cache_location: /loki/index_cache
    # Some trials  write logs from filesystem to s3 faster than 5 minutes
    resync_interval: 20s
    shared_store: s3
  aws:
    s3: http://minioadmin:minioadmin@minio.:9000/loki
    s3forcepathstyle: true

limits_config:
  enforce_metric_name: false
  reject_old_samples: true
  reject_old_samples_max_age: 168h
  ingestion_rate_mb: 32
  retention_period: 24h

compactor:
  working_directory: /loki/boltdb-shipper-compactor
  shared_store: aws
  compaction_interval: 10m
  retention_enabled: true
  # delete after x hours does not work!
  retention_delete_delay: 24h
  retention_delete_worker_count: 150

table_manager:
  retention_deletes_enabled: true
  retention_period: 24h

frontend:
  # Maximum number of outstanding requests per tenant per frontend; requests
  # beyond this error with HTTP 429.
  # CLI flag: -querier.max-outstanding-requests-per-tenant
  max_outstanding_per_tenant: 2048 # default = 100

Thank you

Hello, did you manage to figure it out??

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.