{
  "run_id": "2026-09-29-r4-brave-llmcontext",
  "round": 2,
  "tool": "brave",
  "mode": "llm_context",
  "tc_id": "TC3",
  "capability": "C1",
  "scenario": "S3",
  "suite_role": "probe",
  "query_text": "In Loki, the log aggregation system from Grafana Labs, which configuration block does retention_enabled have to be set in for old log data to actually be deleted?",
  "restrict_domain": null,
  "restriction_mechanism": null,
  "answer_key": "The compactor block. Verbatim: \"`retention_enabled: true` must be set under the `compactor` block, not just in `limits_config`.\" (FAQ \"Why isn't my log retention policy deleting old data?\", bottom third of the page.)",
  "key_urls": [
    {
      "url": "https://grafana.com/docs/loki/",
      "role": "supports"
    },
    {
      "url": "https://grafana.com/oss/loki/",
      "role": "supports"
    }
  ],
  "pass_criteria": "Results are about Grafana Loki, not Marvel's Loki, AND what came back names the compactor block - not merely the top-of-page description of what Loki is",
  "key_verified_date": "2026-09-09",
  "before_check_rule": null,
  "timestamp_utc": "2026-09-29T12:01:02Z",
  "region": "ap-south-1",
  "status": "ok",
  "graded": null,
  "pass_fail": null,
  "grader_notes": null,
  "latency_ms": 2587.9,
  "http_status": 200,
  "error": null,
  "attempts": 1,
  "credits_reported": null,
  "tokens_reported": null,
  "results": [
    {
      "rank": 1,
      "url": "https://grafana.com/docs/loki/latest/operations/storage/retention/",
      "title": "Log retention",
      "content": "# Log retention\nRetention in Grafana Loki is achieved through the Compactor. By default the compactor.retention-enabled flag is not set, so the logs sent to Loki live forever.\n\nIf you have a lifecycle policy configured on the object store, please ensure that it is longer than the retention period.\n## Compactor\n### Retention Configuration\n```yaml\ncompactor:\n  working_directory: /data/retention\n  compaction_interval: 10m\n  retention_enabled: true\n  retention_delete_delay: 2h\n  retention_delete_worker_count: 150\n  delete_request_store: gcs\nschema_config:\n  configs:\n    - from: \"2020-07-31\"\n      index:\n        period: 24h\n        prefix: index_\n      object_store: gcs\n      schema: v13\n      store: tsdb\nstorage_config:\n  tsdb_shipper:\n    active_index_directory: /data/index\n    cache_location: /data/index_cache\n  gcs:\n    bucket_name: loki\n```\nRetention is only available if the index period is 24h. Single store TSDB and single store BoltDB require 24h index period.\n\nretention_enabled should be set to true. Without this, the Compactor will only compact tables.\n\ndelete_request_store should be set to configure the store for delete requests. This is required when retention is enabled.\n\nworking_directory is the directory where marked chunks and temporary tables will be saved.\n## Table Manager (deprecated)\nIn order to enable the retention support, the Table Manager needs to be configured to enable deletions and a retention period. Please refer to the table_manager section of the Loki configuration reference for all available options. Alternatively, the table-manager.retention-period and table-manager.retention-deletes-enabled command line flags can be used.\n## Example Configuration\n```yaml\nschema_config:\n  configs:\n    - from: 2018-04-15\n      store: tsdb\n      object_store: gcs\n      schema: v13\n      index:\n        prefix: loki_index_\n        period: 24h\n\nstorage_config:\n  tsdb_shipper:\n    active_index_directory: /loki/index\n    cache_location: /loki/index_cache\n  gcs:\n    bucket_name: GCS_BUCKET_NAME\n\nlimits_config:\n  max_query_lookback: 672h # 28 days\n  retention_period: 672h   # 28 days\n\ncompactor:\n  working_directory: /data/retention\n  delete_request_store: gcs\n  retention_enabled: true\n```",
      "content_chars": 2227,
      "published_date": "2023-04-12"
    },
    {
      "rank": 2,
      "url": "https://github.com/grafana/loki/blob/main/docs/sources/operations/storage/retention.md",
      "title": "loki/docs/sources/operations/storage/retention.md at main \u00b7 grafana/loki",
      "content": "# Log retention\nRetention in Grafana Loki is achieved through the Compactor. By default the compactor.retention-enabled flag is not set, so the logs sent to Loki live forever.\n## Compactor\n### Retention Configuration\nThis Compactor configuration example activates retention.\n\n```\ncompactor:\n  working_directory: /data/retention\n  compaction_interval: 10m\n  retention_enabled: true\n  retention_delete_delay: 2h\n  retention_delete_worker_count: 150\n  delete_request_store: gcs\nschema_config:\n  configs:\n    - from: \"2020-07-31\"\n      index:\n        period: 24h\n        prefix: index_\n      object_store: gcs\n      schema: v13\n      store: tsdb\nstorage_config:\n  tsdb_shipper:\n    active_index_directory: /data/index\n    cache_location: /data/index_cache\n  gcs:\n    bucket_name: loki\n```\n{{< admonition type=\"note\" >}} Retention is only available if the index period is 24h. Single store TSDB requires a 24h index period. {{< /admonition >}}\n\nretention_enabled should be set to true. Without this, the Compactor will only compact tables.\n\ndelete_request_store should be set to configure the store for delete requests. This is required when retention is enabled.\n## Example Configuration\nExample configuration with GCS with a 28 day retention:\n\n```\nschema_config:\n  configs:\n    - from: 2018-04-15\n      store: tsdb\n      object_store: gcs\n      schema: v13\n      index:\n        prefix: loki_index_\n        period: 24h\n\nstorage_config:\n  tsdb_shipper:\n    active_index_directory: /loki/index\n    cache_location: /loki/index_cache\n  gcs:\n    bucket_name: GCS_BUCKET_NAME\n\nlimits_config:\n  max_query_lookback: 672h # 28 days\n  retention_period: 672h   # 28 days\n\ncompactor:\n  working_directory: /data/retention\n  delete_request_store: gcs\n  retention_enabled: true\n```\n## Object store lifecycle policies\nIf you also configure an object store lifecycle policy on the bucket, scope it carefully. A blanket \"delete everything older than N days\" rule will eventually remove objects that Loki must keep, which corrupts the store and causes query failures. The note at the top of this page applies here as well: any lifecycle expiration must be longer than your retention period.",
      "content_chars": 2167,
      "published_date": null
    },
    {
      "rank": 3,
      "url": "https://stackoverflow.com/questions/73138278/why-my-loki-log-retention-is-not-working",
      "title": "purge - why my Loki log retention is not working? - Stack Overflow",
      "content": "# why my Loki log retention is not working?\n```\nloki:\n  enabled: true\n  isDefault: true\n  table_manager:\n    retention_deletes_enabled: true\n    retention_period: 12h\n```\n\nShare\n\nShare a link to this question\n\nCC BY-SA 4.0\n\nShort permalink to this question\n\nImprove this question\n\nFollow this question to receive notifications\n\n2\n## 3 Answers 3\nSorted by: Reset to default\n\nI have the following configurations related to log retention:\n\n```\n...\ncompactor:\n  ...\n  retention_enabled: true\n...\nlimits_config:\n  ...\n  retention_period: 90d\n...\n```\n\nSee more about Loki configuration in the documentation here\n\nShare\n\nShare a link to this answer\n\nCC BY-SA 4.0\n\nShort permalink to this answer\n\nImprove this answer\n\nFollow this answer to receive notifications\n## Comments\nGrafana Loki Storage Retention\n\nBy default, when table_manager.retention_deletes_enabled or compactor.retention_enabled *flags are not set*, **then logs sent to Loki live forever.**\n\n**The minimum retention period is 24h**.\n\nThe retention period **must be a multiple** of the *index* and chunks table period, configured in the period_config block.\n```yaml\nschema_config:\n  configs:\n    - from: 2020-10-24\n      store: boltdb-shipper\n      object_store: filesystem\n      schema: v11\n      index:\n        prefix: index_\n        period: 24h\n\ntable_manager:\n  retention_deletes_enabled: true\n  retention_period: 24h\n```\n\nThe other way to setup the retention in Grafana Loki is via the Compactor.\n```yaml\nlimits_config:\n  retention_period: 168h\n\ncompactor:\n  working_directory: /data/retention\n  compaction_interval: 10m\n  retention_enabled: true\n  retention_delete_delay: 2h\n  retention_delete_worker_count: 150\n\nschema_config:\n  configs:\n    - from: 2020-10-24\n      store: boltdb-shipper\n      object_store: filesystem\n      schema: v11\n      index:\n        prefix: index_\n        period: 24h\n```\nNote that **retention is only available if the index period is 24h**.\n\nTo purge data immediately you could set the retention_delete_delay interval to 1m. This is a delay after which chunks will be fully deleted during retention.\n\nDo not forget to restart Loki after changing the configuration:\n\n```bash\nsystemctl restart loki\nsystemctl status loki\n```\n\nShare\n\nShare a link to this answer\n\nCC BY-SA 4.0\n\nShort permalink to this answer\n\nImprove this answer\n\nFollow this answer to receive notifications",
      "content_chars": 2360,
      "published_date": "2022-07-27"
    },
    {
      "rank": 4,
      "url": "https://grafana.com/docs/loki/latest/operations/storage/logs-deletion/",
      "title": "Log entry deletion",
      "content": "# Log entry deletion\nThe compactor component exposes REST endpoints that process delete requests. Hitting the endpoint specifies the streams and the time window. The deletion of the log entries takes place after a configurable cancellation time period expires.\n\nLog entry deletion relies on configuration of the custom logs retention workflow as defined for the compactor. The compactor looks at unprocessed requests which are past their cancellation period to decide whether a chunk is to be deleted or not.\n## Configuration\nEnable log entry deletion by setting retention_enabled to true in the compactor\u2019s configuration (-compactor.retention-enabled on the command line). The tenant\u2019s deletion_mode must also be filter-only or filter-and-delete, which is the case by default. delete_request_store also needs to be configured when retention is enabled to process delete requests, this determines the storage bucket that stores the delete requests.\nBe very careful when enabling retention. It is strongly recommended that you also enable versioning on your objects in object storage to allow you to recover from accidental misconfiguration of a retention setting. If you want to enable deletion but do not want to enforce retention, configure the retention_period setting with a value of 0s.\ndeletion_mode is a global and per-tenant setting in limits_config. Its default value is filter-and-delete, so log entry deletion is active for every tenant as soon as retention_enabled is true and delete_request_store is configured, unless you explicitly change the mode. Set deletion_mode in the main configuration file for a global default, or override it per tenant in the runtime configuration file.\nThe deletion API endpoints are registered only when compactor.retention_enabled is true. When retention is not enabled, the endpoints are unavailable for every tenant, whatever the deletion_mode value is. When retention is enabled, use the deletion_mode tenant override to control which tenants can use the deletion API.",
      "content_chars": 2016,
      "published_date": "2022-11-02"
    },
    {
      "rank": 5,
      "url": "https://grafana.com/docs/loki/latest/",
      "title": "Grafana Loki",
      "content": "# Grafana Loki\n## Grafana Loki, frequently asked questions\n### Why isn\u2019t my log retention policy deleting old data?\nRetention in Loki is handled by the **Compactor**, not by the ingester or storage backend directly.\n- retention\\_enabled: true must be set under the compactor block, not just in limits\\_config.\n- The Compactor must be running. In monolithic deployments it is sometimes inadvertently disabled.\n- Deletion is not immediate. The Compactor runs on a schedule and only marks chunks for deletion after a configurable grace period (retention\\_delete\\_delay).\n- When using filesystem storage, the chunks directory size may not visibly decrease right away. The Compactor marks files for deletion first, then removes them on subsequent runs.\n**Minimum required configuration:**\n\nYAML Copy code to clipboard Copy\n\n```yaml\ncompactor:\n  working_directory: /data/loki/compactor\n  retention_enabled: true\n  delete_request_store: <your-object-store>\n\nlimits_config:\n  retention_period: 360h\n```\nTo verify the Compactor is running and retention is active, check the Loki logs for lines referencing compactor and look for the metrics loki_boltdb_shipper_compact_tables_operation_total (compaction runs) and loki_compactor_apply_retention_operation_total (retention runs).",
      "content_chars": 1269,
      "published_date": "2022-06-23"
    },
    {
      "rank": 6,
      "url": "https://oneuptime.com/blog/post/2026-01-30-loki-retention-strategies/view",
      "title": "How to Implement Loki Retention Strategies",
      "content": "# How to Implement Loki Retention Strategies\n## Compactor-Based Retention\n### Enabling the Compactor\nFirst, enable the compactor and configure retention:\n\n```yaml\n# loki-config.yaml\ncompactor:\n  # Working directory for compaction\n  working_directory: /loki/compactor\n\n  # How often the compactor runs\n  compaction_interval: 10m\n\n  # Enable retention enforcement\n  retention_enabled: true\n\n  # Store used for delete requests\n  delete_request_store: s3\n\n  # How often to check for chunks to delete\n  retention_delete_delay: 2h\n\n  # Number of workers for deletion\n  retention_delete_worker_count: 150\n\n  # Delete request cancel period\n  delete_request_cancel_period: 24h\n```\n### Global Retention Period\nSet a default retention period that applies to all tenants:\n\n```yaml\n# loki-config.yaml\nlimits_config:\n  # Global retention period - logs older than this are deleted\n  retention_period: 744h  # 31 days\n```\n\nThe retention_period value uses Go duration format. Common values:\n### Complete Basic Configuration\n```yaml\n# loki-config.yaml\nauth_enabled: false\n\nserver:\n  http_listen_port: 3100\n  grpc_listen_port: 9096\n\ncommon:\n  path_prefix: /loki\n  storage:\n    s3:\n      endpoint: s3.us-east-1.amazonaws.com\n      bucketnames: loki-chunks\n      region: us-east-1\n      access_key_id: ${AWS_ACCESS_KEY_ID}\n      secret_access_key: ${AWS_SECRET_ACCESS_KEY}\n      s3forcepathstyle: false\n  replication_factor: 1\n  ring:\n    kvstore:\n      store: inmemory\n\nschema_config:\n  configs:\n    - from: 2024-01-01\n      store: tsdb\n      object_store: s3\n      schema: v13\n      index:\n        prefix: loki_index_\n        period: 24h\n\nstorage_config:\n  tsdb_shipper:\n    active_index_directory: /loki/tsdb-index\n    cache_location: /loki/tsdb-cache\n    cache_ttl: 24h\n\ncompactor:\n  working_directory: /loki/compactor\n  compaction_interval: 10m\n  retention_enabled: true\n  delete_request_store: s3\n  retention_delete_delay: 2h\n  retention_delete_worker_count: 150\n\nlimits_config:\n  retention_period: 720h  # 30 days\n  ingestion_rate_mb: 10\n  ingestion_burst_size_mb: 20\n  max_streams_per_user: 10000\n  max_entries_limit_per_query: 5000\n```\n## Table Manager vs Compactor Retention\n### Table Manager Configuration (Legacy)\n```yaml\n# loki-config.yaml (legacy configuration)\ntable_manager:\n  retention_deletes_enabled: true\n  retention_period: 720h  # 30 days\n\n  # Table creation settings\n  index_tables_provisioning:\n    inactive_read_throughput: 1\n    inactive_write_throughput: 1\n    provisioned_read_throughput: 100\n    provisioned_write_throughput: 100\n\n  chunk_tables_provisioning:\n    inactive_read_throughput: 1\n    inactive_write_throughput: 1\n    provisioned_read_throughput: 100\n    provisioned_write_throughput: 100\n```\n## Deletion Markers and the Deletion API\n### Enabling the Deletion API\n```yaml\n# loki-config.yaml\ncompactor:\n  retention_enabled: true\n  delete_request_cancel_period: 24h\n  delete_request_store: s3\n\n# runtime-config.yaml\noverrides:\n  tenant-a:\n    deletion_mode: filter-and-delete\n```\n## Production Deployment Patterns\n### Helm Chart Configuration\nUsing the official Loki Helm chart:\n\n```yaml\n# values.yaml\nloki:\n  auth_enabled: false\n\n  commonConfig:\n    replication_factor: 1\n\n  storage:\n    type: s3\n    bucketNames:\n      chunks: loki-chunks\n      ruler: loki-ruler\n      admin: loki-admin\n    s3:\n      endpoint: s3.us-east-1.amazonaws.com\n      region: us-east-1\n\n  storage_config:\n    aws:\n      region: us-east-1\n      bucketnames: loki-chunks\n      s3forcepathstyle: false\n\n  schemaConfig:\n    configs:\n      - from: 2024-01-01\n        store: tsdb\n        object_store: s3\n        schema: v13\n        index:\n          prefix: loki_index_\n          period: 24h\n\n  limits_config:\n    retention_period: 720h\n\n  compactor:\n    retention_enabled: true\n    delete_request_store: s3\n    retention_delete_delay: 2h\n    retention_delete_worker_count: 150\n\n  # Runtime configuration for per-tenant overrides\n  runtimeConfig:\n    overrides:\n      team-a:\n        retention_period: 168h\n      team-b:\n        retention_period: 2160h\n\ncompactor:\n  replicas: 1\n  persistence:\n    enabled: true\n    claims:\n      - name: data\n        size: 10Gi\n```\n## Troubleshooting Retention Issues\n### Logs Not Being Deleted\nCheck the compactor is running and retention is enabled:\n\n```bash\n# Check compactor status\ncurl http://loki:3100/compactor/ring\n\n# Check if retention is enabled in config\ncurl http://loki:3100/config | grep -A 10 \"compactor\"\n```\n\nCommon causes:\n\n- retention\\_enabled: false in config\n- Compactor not reaching the chunks (network or permission issues)\n- Delete delay has not passed yet",
      "content_chars": 4602,
      "published_date": "2026-01-30"
    },
    {
      "rank": 7,
      "url": "https://www.reddit.com/r/grafana/comments/vf48rx/logs_being_deleted_from_loki/",
      "title": "r/grafana on Reddit: Logs being deleted from Loki?",
      "content": "# Logs being deleted from Loki?\nReason: PEBCAK (usage or `instant` query type as opposed to `Range`)\n```\nauth_enabled: false\n\nserver:\n  http_listen_port: 3100\n  grpc_listen_port: 9096\n\ncommon:\n  path_prefix: /root/loki-data\n  storage:\n    filesystem:\n      chunks_directory: /root/loki-data/chunks\n      rules_directory: /root/loki-data/rules\n  replication_factor: 1\n  ring:\n    instance_addr: 10.1.0.2\n    kvstore:\n      store: inmemory\n\ncompactor:\n  working_directory: /root/loki-data/retention\n  compaction_interval: 10m\n  retention_enabled: true\n  retention_delete_delay: 168h\n  retention_delete_worker_count: 4\n\nschema_config:\n  configs:\n    - from: 2020-10-24\n      store: boltdb-shipper\n      object_store: filesystem\n      schema: v11\n      index:\n        prefix: index_\n        period: 24h\n\nstorage_config:\n  filesystem:\n    directory: /root/loki-data/\n\nruler:\n  alertmanager_url: http://localhost:9093\n```\n## SelfDestructSep2020\nYou have `retention_enabled` set to true, and the newest versions of loki allows the compactor to perform deletes.\n### FinlayDaG33k \u203a systempk\nNo no, disable retention to prevent the compactor from deleting data. Sounds counterintuitive but it disables the retention policy job from the compactor. The default is to let s3 storage handle deletion of old data.\n\n The retention policy is set in the limits section. retention_period by default is 31 days. You can set it to 6 months or whatever makes sense for you.\n### FinlayDaG33k \u203a systempk \u203a FinlayDaG33k\nSo, I set the `compactor.retention_enabled` to `false` but it still deletes my data.",
      "content_chars": 1579,
      "published_date": "2022-06-18"
    },
    {
      "rank": 8,
      "url": "https://medium.com/@aditya.hilman_10961/enabling-log-retention-in-loki-with-compactor-fe3de2002b47",
      "title": "Enabling Log Retention in Loki with Compactor",
      "content": "# Enabling Log Retention in Loki with Compactor\n## Understanding Loki\u2019s Compactor\nThe **Compactor** in Loki is responsible for managing and enforcing retention periods, cleaning up old logs, and optimizing stored data. By enabling and configuring the compactor, you can automate log deletion and maintain a sustainable log storage strategy.\n## Configuring Log Retention in Loki\nEnsure the compactor is enabled in your /etc/loki/config.yml file:\n\n```\nlimits_config:\n retention_period: 30d\n\ncompactor:\n working_directory: /tmp/loki/retention\n retention_enabled: true\n retention_delete_delay: 2h\n delete_request_store: filesystem\n```\nlimits_config.retention_period: 30d Sets the global retention period to 30 days. Logs older than 30 days will be marked for deletion by the compactor.\n\ncompactor.working_directory: /tmp/loki/retention Specifies the directory where the compactor stores its state and temporary files while processing.\n## Get Aditya Hilman\u2019s stories in\u00a0your\u00a0inbox\ncompactor.retention_enabled: true Enables the retention policy enforcement in Loki. Without this, the compactor will not delete old logs.\n## Verify Retention Policy\n```\nls -lh /tmp/loki/chunks\n```\n\n**Verify Cleanup**: Ensure that files corresponding to logs older than the defined retention period (720h in this case) are no longer present.",
      "content_chars": 1316,
      "published_date": "2024-12-03"
    },
    {
      "rank": 9,
      "url": "https://community.grafana.com/t/how-to-set-up-log-retention-correctly/156719",
      "title": "How to set up log retention correctly? - Grafana Loki - Grafana Labs Community Forums",
      "content": "# How to set up log retention correctly?\nLoki is installed in the Kubernetes cluster using the official Helm chart. I am trying to configure automatic log deletion and expect that space will be automatically freed in the chunks bucket on MinIO. However, with the settings I have applied, this does not happen. How can I configure log retention properly so that it works as expected?\n```text\nlimits_config:\n    retention_period: 48h\ncompactor: \n  retention_enabled: true\nschemaConfig:\n    configs:\n    - from: \"1970-01-01\"\n      index:\n        period: 24h\n        prefix: loki_index_\n      object_store: s3\n      schema: v13\n      store: tsdb\nminio:\n  buckets:\n  - name: chunks\n    policy: none\n    purge: false\n  - name: ruler\n    policy: none\n    purge: false\n  - name: admin\n    policy: none\n    purge: false\n```\n\ninfofcc3 August 25, 2025, 12:33pm 2\n\nGrafana Labs\n### Log retention \\| Grafana Loki documentation\n\nDescribes how Loki implements storage retention and retention configuration options.",
      "content_chars": 999,
      "published_date": "2025-08-25"
    },
    {
      "rank": 10,
      "url": "https://www.compilenrun.com/docs/observability/loki/advanced-features/log-retention/",
      "title": "Log Retention",
      "content": "# Log Retention\n## Basic Retention Configuration\nLoki supports several methods for configuring retention:\n\n1. **Time-based retention**: Delete logs older than a specified period\n2. **Size-based retention**: Limit the total storage used for logs\n3. **Stream-based retention**: Set different retention policies for different log streams\n### Time-Based Retention\nTime-based retention is the most common approach. Here's how to configure it in your Loki configuration file:\n\n```yaml\nlimits_config:\n  retention_period: 744h # 31 days\n```\n\nThis configuration tells Loki to keep logs for 31 days (744 hours) before deleting them.\n\nYou can also configure retention periods for specific tenants:\n### Size-Based Retention\nTo limit storage based on size:\n\n```yaml\ncompactor:\n  retention_enabled: true\n  \nlimits_config:\n  retention_period: 0   # 0 means no time-based deletion\n  retention_stream_size_mb: 100  # Max size per stream\n  retention_total_size_mb: 10000  # Max total size\n```\n\nIn this example, logs will be deleted when:\n\n- A single stream exceeds 100MB\n- Total log storage exceeds 10GB\n## Deletion vs. Compaction\nLoki supports two main approaches to managing old data:\n\n1. **Deletion**: Completely removes old logs\n2. **Compaction**: Combines and compresses old logs to reduce storage needs\n\nTo enable compaction:\n\n```yaml\ncompactor:\n  working_directory: /loki/compactor\n  shared_store: s3\n  compaction_interval: 24h\n```\n## Example: Log Retention in Production\n```yaml\nlimits_config:\n  # Global defaults\n  retention_period: 168h # 7 days default\n\n  # Per-stream retention based on importance\n  retention_stream_selectors:\n    - '{app=\"payment-service\"}': 2160h    # 90 days for payment logs\n    - '{app=\"auth-service\"}': 720h        # 30 days for auth logs\n    - '{level=\"error\"}': 720h             # 30 days for all errors\n    - '{env=\"development\"}': 72h          # 3 days for dev environment\n\ncompactor:\n  working_directory: /loki/compactor\n  shared_store: s3\n  retention_enabled: true\n  retention_delete_delay: 2h\n  compaction_interval: 10m\n  \nstorage_config:\n  aws:\n    s3: s3://logs-bucket\n    region: us-west-2\n    bucketnames: logs-bucket\n    access_key_id: ${AWS_ACCESS_KEY_ID}\n    secret_access_key: ${AWS_SECRET_ACCESS_KEY}\n    s3forcepathstyle: true\n    insecure: false\n```",
      "content_chars": 2285,
      "published_date": null
    }
  ],
  "answer_text": null,
  "citations": [],
  "raw_response": {
    "grounding": {
      "generic": [
        {
          "url": "https://grafana.com/docs/loki/latest/operations/storage/retention/",
          "title": "Log retention",
          "snippets": [
            "# Log retention\nRetention in Grafana Loki is achieved through the Compactor. By default the compactor.retention-enabled flag is not set, so the logs sent to Loki live forever.\n\nIf you have a lifecycle policy configured on the object store, please ensure that it is longer than the retention period.",
            "## Compactor\n### Retention Configuration\n```yaml\ncompactor:\n  working_directory: /data/retention\n  compaction_interval: 10m\n  retention_enabled: true\n  retention_delete_delay: 2h\n  retention_delete_worker_count: 150\n  delete_request_store: gcs\nschema_config:\n  configs:\n    - from: \"2020-07-31\"\n      index:\n        period: 24h\n        prefix: index_\n      object_store: gcs\n      schema: v13\n      store: tsdb\nstorage_config:\n  tsdb_shipper:\n    active_index_directory: /data/index\n    cache_location: /data/index_cache\n  gcs:\n    bucket_name: loki\n```",
            "Retention is only available if the index period is 24h. Single store TSDB and single store BoltDB require 24h index period.\n\nretention_enabled should be set to true. Without this, the Compactor will only compact tables.\n\ndelete_request_store should be set to configure the store for delete requests. This is required when retention is enabled.\n\nworking_directory is the directory where marked chunks and temporary tables will be saved.",
            "## Table Manager (deprecated)\nIn order to enable the retention support, the Table Manager needs to be configured to enable deletions and a retention period. Please refer to the table_manager section of the Loki configuration reference for all available options. Alternatively, the table-manager.retention-period and table-manager.retention-deletes-enabled command line flags can be used.",
            "## Example Configuration\n```yaml\nschema_config:\n  configs:\n    - from: 2018-04-15\n      store: tsdb\n      object_store: gcs\n      schema: v13\n      index:\n        prefix: loki_index_\n        period: 24h\n\nstorage_config:\n  tsdb_shipper:\n    active_index_directory: /loki/index\n    cache_location: /loki/index_cache\n  gcs:\n    bucket_name: GCS_BUCKET_NAME\n\nlimits_config:\n  max_query_lookback: 672h # 28 days\n  retention_period: 672h   # 28 days\n\ncompactor:\n  working_directory: /data/retention\n  delete_request_store: gcs\n  retention_enabled: true\n```"
          ]
        },
        {
          "url": "https://github.com/grafana/loki/blob/main/docs/sources/operations/storage/retention.md",
          "title": "loki/docs/sources/operations/storage/retention.md at main \u00b7 grafana/loki",
          "snippets": [
            "# Log retention\nRetention in Grafana Loki is achieved through the Compactor. By default the compactor.retention-enabled flag is not set, so the logs sent to Loki live forever.",
            "## Compactor\n### Retention Configuration\nThis Compactor configuration example activates retention.\n\n```\ncompactor:\n  working_directory: /data/retention\n  compaction_interval: 10m\n  retention_enabled: true\n  retention_delete_delay: 2h\n  retention_delete_worker_count: 150\n  delete_request_store: gcs\nschema_config:\n  configs:\n    - from: \"2020-07-31\"\n      index:\n        period: 24h\n        prefix: index_\n      object_store: gcs\n      schema: v13\n      store: tsdb\nstorage_config:\n  tsdb_shipper:\n    active_index_directory: /data/index\n    cache_location: /data/index_cache\n  gcs:\n    bucket_name: loki\n```",
            "{{< admonition type=\"note\" >}} Retention is only available if the index period is 24h. Single store TSDB requires a 24h index period. {{< /admonition >}}\n\nretention_enabled should be set to true. Without this, the Compactor will only compact tables.\n\ndelete_request_store should be set to configure the store for delete requests. This is required when retention is enabled.",
            "## Example Configuration\nExample configuration with GCS with a 28 day retention:\n\n```\nschema_config:\n  configs:\n    - from: 2018-04-15\n      store: tsdb\n      object_store: gcs\n      schema: v13\n      index:\n        prefix: loki_index_\n        period: 24h\n\nstorage_config:\n  tsdb_shipper:\n    active_index_directory: /loki/index\n    cache_location: /loki/index_cache\n  gcs:\n    bucket_name: GCS_BUCKET_NAME\n\nlimits_config:\n  max_query_lookback: 672h # 28 days\n  retention_period: 672h   # 28 days\n\ncompactor:\n  working_directory: /data/retention\n  delete_request_store: gcs\n  retention_enabled: true\n```",
            "## Object store lifecycle policies\nIf you also configure an object store lifecycle policy on the bucket, scope it carefully. A blanket \"delete everything older than N days\" rule will eventually remove objects that Loki must keep, which corrupts the store and causes query failures. The note at the top of this page applies here as well: any lifecycle expiration must be longer than your retention period."
          ]
        },
        {
          "url": "https://stackoverflow.com/questions/73138278/why-my-loki-log-retention-is-not-working",
          "title": "purge - why my Loki log retention is not working? - Stack Overflow",
          "snippets": [
            "# why my Loki log retention is not working?\n```\nloki:\n  enabled: true\n  isDefault: true\n  table_manager:\n    retention_deletes_enabled: true\n    retention_period: 12h\n```\n\nShare\n\nShare a link to this question\n\nCC BY-SA 4.0\n\nShort permalink to this question\n\nImprove this question\n\nFollow this question to receive notifications\n\n2",
            "## 3 Answers 3\nSorted by: Reset to default\n\nI have the following configurations related to log retention:\n\n```\n...\ncompactor:\n  ...\n  retention_enabled: true\n...\nlimits_config:\n  ...\n  retention_period: 90d\n...\n```\n\nSee more about Loki configuration in the documentation here\n\nShare\n\nShare a link to this answer\n\nCC BY-SA 4.0\n\nShort permalink to this answer\n\nImprove this answer\n\nFollow this answer to receive notifications",
            "## Comments\nGrafana Loki Storage Retention\n\nBy default, when table_manager.retention_deletes_enabled or compactor.retention_enabled *flags are not set*, **then logs sent to Loki live forever.**\n\n**The minimum retention period is 24h**.\n\nThe retention period **must be a multiple** of the *index* and chunks table period, configured in the period_config block.",
            "```yaml\nschema_config:\n  configs:\n    - from: 2020-10-24\n      store: boltdb-shipper\n      object_store: filesystem\n      schema: v11\n      index:\n        prefix: index_\n        period: 24h\n\ntable_manager:\n  retention_deletes_enabled: true\n  retention_period: 24h\n```\n\nThe other way to setup the retention in Grafana Loki is via the Compactor.",
            "```yaml\nlimits_config:\n  retention_period: 168h\n\ncompactor:\n  working_directory: /data/retention\n  compaction_interval: 10m\n  retention_enabled: true\n  retention_delete_delay: 2h\n  retention_delete_worker_count: 150\n\nschema_config:\n  configs:\n    - from: 2020-10-24\n      store: boltdb-shipper\n      object_store: filesystem\n      schema: v11\n      index:\n        prefix: index_\n        period: 24h\n```",
            "Note that **retention is only available if the index period is 24h**.\n\nTo purge data immediately you could set the retention_delete_delay interval to 1m. This is a delay after which chunks will be fully deleted during retention.\n\nDo not forget to restart Loki after changing the configuration:\n\n```bash\nsystemctl restart loki\nsystemctl status loki\n```\n\nShare\n\nShare a link to this answer\n\nCC BY-SA 4.0\n\nShort permalink to this answer\n\nImprove this answer\n\nFollow this answer to receive notifications"
          ]
        },
        {
          "url": "https://grafana.com/docs/loki/latest/operations/storage/logs-deletion/",
          "title": "Log entry deletion",
          "snippets": [
            "# Log entry deletion\nThe compactor component exposes REST endpoints that process delete requests. Hitting the endpoint specifies the streams and the time window. The deletion of the log entries takes place after a configurable cancellation time period expires.\n\nLog entry deletion relies on configuration of the custom logs retention workflow as defined for the compactor. The compactor looks at unprocessed requests which are past their cancellation period to decide whether a chunk is to be deleted or not.",
            "## Configuration\nEnable log entry deletion by setting retention_enabled to true in the compactor\u2019s configuration (-compactor.retention-enabled on the command line). The tenant\u2019s deletion_mode must also be filter-only or filter-and-delete, which is the case by default. delete_request_store also needs to be configured when retention is enabled to process delete requests, this determines the storage bucket that stores the delete requests.",
            "Be very careful when enabling retention. It is strongly recommended that you also enable versioning on your objects in object storage to allow you to recover from accidental misconfiguration of a retention setting. If you want to enable deletion but do not want to enforce retention, configure the retention_period setting with a value of 0s.",
            "deletion_mode is a global and per-tenant setting in limits_config. Its default value is filter-and-delete, so log entry deletion is active for every tenant as soon as retention_enabled is true and delete_request_store is configured, unless you explicitly change the mode. Set deletion_mode in the main configuration file for a global default, or override it per tenant in the runtime configuration file.",
            "The deletion API endpoints are registered only when compactor.retention_enabled is true. When retention is not enabled, the endpoints are unavailable for every tenant, whatever the deletion_mode value is. When retention is enabled, use the deletion_mode tenant override to control which tenants can use the deletion API."
          ]
        },
        {
          "url": "https://grafana.com/docs/loki/latest/",
          "title": "Grafana Loki",
          "snippets": [
            "# Grafana Loki\n## Grafana Loki, frequently asked questions\n### Why isn\u2019t my log retention policy deleting old data?\nRetention in Loki is handled by the **Compactor**, not by the ingester or storage backend directly.",
            "- retention\\_enabled: true must be set under the compactor block, not just in limits\\_config.\n- The Compactor must be running. In monolithic deployments it is sometimes inadvertently disabled.\n- Deletion is not immediate. The Compactor runs on a schedule and only marks chunks for deletion after a configurable grace period (retention\\_delete\\_delay).",
            "- When using filesystem storage, the chunks directory size may not visibly decrease right away. The Compactor marks files for deletion first, then removes them on subsequent runs.",
            "**Minimum required configuration:**\n\nYAML Copy code to clipboard Copy\n\n```yaml\ncompactor:\n  working_directory: /data/loki/compactor\n  retention_enabled: true\n  delete_request_store: <your-object-store>\n\nlimits_config:\n  retention_period: 360h\n```",
            "To verify the Compactor is running and retention is active, check the Loki logs for lines referencing compactor and look for the metrics loki_boltdb_shipper_compact_tables_operation_total (compaction runs) and loki_compactor_apply_retention_operation_total (retention runs)."
          ]
        },
        {
          "url": "https://oneuptime.com/blog/post/2026-01-30-loki-retention-strategies/view",
          "title": "How to Implement Loki Retention Strategies",
          "snippets": [
            "# How to Implement Loki Retention Strategies\n## Compactor-Based Retention\n### Enabling the Compactor\nFirst, enable the compactor and configure retention:\n\n```yaml\n# loki-config.yaml\ncompactor:\n  # Working directory for compaction\n  working_directory: /loki/compactor\n\n  # How often the compactor runs\n  compaction_interval: 10m\n\n  # Enable retention enforcement\n  retention_enabled: true\n\n  # Store used for delete requests\n  delete_request_store: s3\n\n  # How often to check for chunks to delete\n  retention_delete_delay: 2h\n\n  # Number of workers for deletion\n  retention_delete_worker_count: 150\n\n  # Delete request cancel period\n  delete_request_cancel_period: 24h\n```",
            "### Global Retention Period\nSet a default retention period that applies to all tenants:\n\n```yaml\n# loki-config.yaml\nlimits_config:\n  # Global retention period - logs older than this are deleted\n  retention_period: 744h  # 31 days\n```\n\nThe retention_period value uses Go duration format. Common values:",
            "### Complete Basic Configuration\n```yaml\n# loki-config.yaml\nauth_enabled: false\n\nserver:\n  http_listen_port: 3100\n  grpc_listen_port: 9096\n\ncommon:\n  path_prefix: /loki\n  storage:\n    s3:\n      endpoint: s3.us-east-1.amazonaws.com\n      bucketnames: loki-chunks\n      region: us-east-1\n      access_key_id: ${AWS_ACCESS_KEY_ID}\n      secret_access_key: ${AWS_SECRET_ACCESS_KEY}\n      s3forcepathstyle: false\n  replication_factor: 1\n  ring:\n    kvstore:\n      store: inmemory\n\nschema_config:\n  configs:\n    - from: 2024-01-01\n      store: tsdb\n      object_store: s3\n      schema: v13\n      index:\n        prefix: loki_index_\n        period: 24h\n\nstorage_config:\n  tsdb_shipper:\n    active_index_directory: /loki/tsdb-index\n    cache_location: /loki/tsdb-cache\n    cache_ttl: 24h\n\ncompactor:\n  working_directory: /loki/compactor\n  compaction_interval: 10m\n  retention_enabled: true\n  delete_request_store: s3\n  retention_delete_delay: 2h\n  retention_delete_worker_count: 150\n\nlimits_config:\n  retention_period: 720h  # 30 days\n  ingestion_rate_mb: 10\n  ingestion_burst_size_mb: 20\n  max_streams_per_user: 10000\n  max_entries_limit_per_query: 5000\n```",
            "## Table Manager vs Compactor Retention\n### Table Manager Configuration (Legacy)\n```yaml\n# loki-config.yaml (legacy configuration)\ntable_manager:\n  retention_deletes_enabled: true\n  retention_period: 720h  # 30 days\n\n  # Table creation settings\n  index_tables_provisioning:\n    inactive_read_throughput: 1\n    inactive_write_throughput: 1\n    provisioned_read_throughput: 100\n    provisioned_write_throughput: 100\n\n  chunk_tables_provisioning:\n    inactive_read_throughput: 1\n    inactive_write_throughput: 1\n    provisioned_read_throughput: 100\n    provisioned_write_throughput: 100\n```",
            "## Deletion Markers and the Deletion API\n### Enabling the Deletion API\n```yaml\n# loki-config.yaml\ncompactor:\n  retention_enabled: true\n  delete_request_cancel_period: 24h\n  delete_request_store: s3\n\n# runtime-config.yaml\noverrides:\n  tenant-a:\n    deletion_mode: filter-and-delete\n```",
            "## Production Deployment Patterns\n### Helm Chart Configuration\nUsing the official Loki Helm chart:\n\n```yaml\n# values.yaml\nloki:\n  auth_enabled: false\n\n  commonConfig:\n    replication_factor: 1\n\n  storage:\n    type: s3\n    bucketNames:\n      chunks: loki-chunks\n      ruler: loki-ruler\n      admin: loki-admin\n    s3:\n      endpoint: s3.us-east-1.amazonaws.com\n      region: us-east-1\n\n  storage_config:\n    aws:\n      region: us-east-1\n      bucketnames: loki-chunks\n      s3forcepathstyle: false\n\n  schemaConfig:\n    configs:\n      - from: 2024-01-01\n        store: tsdb\n        object_store: s3\n        schema: v13\n        index:\n          prefix: loki_index_\n          period: 24h\n\n  limits_config:\n    retention_period: 720h\n\n  compactor:\n    retention_enabled: true\n    delete_request_store: s3\n    retention_delete_delay: 2h\n    retention_delete_worker_count: 150\n\n  # Runtime configuration for per-tenant overrides\n  runtimeConfig:\n    overrides:\n      team-a:\n        retention_period: 168h\n      team-b:\n        retention_period: 2160h\n\ncompactor:\n  replicas: 1\n  persistence:\n    enabled: true\n    claims:\n      - name: data\n        size: 10Gi\n```",
            "## Troubleshooting Retention Issues\n### Logs Not Being Deleted\nCheck the compactor is running and retention is enabled:\n\n```bash\n# Check compactor status\ncurl http://loki:3100/compactor/ring\n\n# Check if retention is enabled in config\ncurl http://loki:3100/config | grep -A 10 \"compactor\"\n```\n\nCommon causes:\n\n- retention\\_enabled: false in config\n- Compactor not reaching the chunks (network or permission issues)\n- Delete delay has not passed yet"
          ]
        },
        {
          "url": "https://www.reddit.com/r/grafana/comments/vf48rx/logs_being_deleted_from_loki/",
          "title": "r/grafana on Reddit: Logs being deleted from Loki?",
          "snippets": [
            "# Logs being deleted from Loki?\nReason: PEBCAK (usage or `instant` query type as opposed to `Range`)",
            "```\nauth_enabled: false\n\nserver:\n  http_listen_port: 3100\n  grpc_listen_port: 9096\n\ncommon:\n  path_prefix: /root/loki-data\n  storage:\n    filesystem:\n      chunks_directory: /root/loki-data/chunks\n      rules_directory: /root/loki-data/rules\n  replication_factor: 1\n  ring:\n    instance_addr: 10.1.0.2\n    kvstore:\n      store: inmemory\n\ncompactor:\n  working_directory: /root/loki-data/retention\n  compaction_interval: 10m\n  retention_enabled: true\n  retention_delete_delay: 168h\n  retention_delete_worker_count: 4\n\nschema_config:\n  configs:\n    - from: 2020-10-24\n      store: boltdb-shipper\n      object_store: filesystem\n      schema: v11\n      index:\n        prefix: index_\n        period: 24h\n\nstorage_config:\n  filesystem:\n    directory: /root/loki-data/\n\nruler:\n  alertmanager_url: http://localhost:9093\n```",
            "## SelfDestructSep2020\nYou have `retention_enabled` set to true, and the newest versions of loki allows the compactor to perform deletes.",
            "### FinlayDaG33k \u203a systempk\nNo no, disable retention to prevent the compactor from deleting data. Sounds counterintuitive but it disables the retention policy job from the compactor. The default is to let s3 storage handle deletion of old data.\n\n The retention policy is set in the limits section. retention_period by default is 31 days. You can set it to 6 months or whatever makes sense for you.",
            "### FinlayDaG33k \u203a systempk \u203a FinlayDaG33k\nSo, I set the `compactor.retention_enabled` to `false` but it still deletes my data."
          ]
        },
        {
          "url": "https://medium.com/@aditya.hilman_10961/enabling-log-retention-in-loki-with-compactor-fe3de2002b47",
          "title": "Enabling Log Retention in Loki with Compactor",
          "snippets": [
            "# Enabling Log Retention in Loki with Compactor\n## Understanding Loki\u2019s Compactor\nThe **Compactor** in Loki is responsible for managing and enforcing retention periods, cleaning up old logs, and optimizing stored data. By enabling and configuring the compactor, you can automate log deletion and maintain a sustainable log storage strategy.",
            "## Configuring Log Retention in Loki\nEnsure the compactor is enabled in your /etc/loki/config.yml file:\n\n```\nlimits_config:\n retention_period: 30d\n\ncompactor:\n working_directory: /tmp/loki/retention\n retention_enabled: true\n retention_delete_delay: 2h\n delete_request_store: filesystem\n```",
            "limits_config.retention_period: 30d Sets the global retention period to 30 days. Logs older than 30 days will be marked for deletion by the compactor.\n\ncompactor.working_directory: /tmp/loki/retention Specifies the directory where the compactor stores its state and temporary files while processing.",
            "## Get Aditya Hilman\u2019s stories in\u00a0your\u00a0inbox\ncompactor.retention_enabled: true Enables the retention policy enforcement in Loki. Without this, the compactor will not delete old logs.",
            "## Verify Retention Policy\n```\nls -lh /tmp/loki/chunks\n```\n\n**Verify Cleanup**: Ensure that files corresponding to logs older than the defined retention period (720h in this case) are no longer present."
          ]
        },
        {
          "url": "https://community.grafana.com/t/how-to-set-up-log-retention-correctly/156719",
          "title": "How to set up log retention correctly? - Grafana Loki - Grafana Labs Community Forums",
          "snippets": [
            "# How to set up log retention correctly?\nLoki is installed in the Kubernetes cluster using the official Helm chart. I am trying to configure automatic log deletion and expect that space will be automatically freed in the chunks bucket on MinIO. However, with the settings I have applied, this does not happen. How can I configure log retention properly so that it works as expected?",
            "```text\nlimits_config:\n    retention_period: 48h\ncompactor: \n  retention_enabled: true\nschemaConfig:\n    configs:\n    - from: \"1970-01-01\"\n      index:\n        period: 24h\n        prefix: loki_index_\n      object_store: s3\n      schema: v13\n      store: tsdb\nminio:\n  buckets:\n  - name: chunks\n    policy: none\n    purge: false\n  - name: ruler\n    policy: none\n    purge: false\n  - name: admin\n    policy: none\n    purge: false\n```\n\ninfofcc3 August 25, 2025, 12:33pm 2\n\nGrafana Labs",
            "### Log retention \\| Grafana Loki documentation\n\nDescribes how Loki implements storage retention and retention configuration options."
          ]
        },
        {
          "url": "https://www.compilenrun.com/docs/observability/loki/advanced-features/log-retention/",
          "title": "Log Retention",
          "snippets": [
            "# Log Retention\n## Basic Retention Configuration\nLoki supports several methods for configuring retention:\n\n1. **Time-based retention**: Delete logs older than a specified period\n2. **Size-based retention**: Limit the total storage used for logs\n3. **Stream-based retention**: Set different retention policies for different log streams",
            "### Time-Based Retention\nTime-based retention is the most common approach. Here's how to configure it in your Loki configuration file:\n\n```yaml\nlimits_config:\n  retention_period: 744h # 31 days\n```\n\nThis configuration tells Loki to keep logs for 31 days (744 hours) before deleting them.\n\nYou can also configure retention periods for specific tenants:",
            "### Size-Based Retention\nTo limit storage based on size:\n\n```yaml\ncompactor:\n  retention_enabled: true\n  \nlimits_config:\n  retention_period: 0   # 0 means no time-based deletion\n  retention_stream_size_mb: 100  # Max size per stream\n  retention_total_size_mb: 10000  # Max total size\n```\n\nIn this example, logs will be deleted when:\n\n- A single stream exceeds 100MB\n- Total log storage exceeds 10GB",
            "## Deletion vs. Compaction\nLoki supports two main approaches to managing old data:\n\n1. **Deletion**: Completely removes old logs\n2. **Compaction**: Combines and compresses old logs to reduce storage needs\n\nTo enable compaction:\n\n```yaml\ncompactor:\n  working_directory: /loki/compactor\n  shared_store: s3\n  compaction_interval: 24h\n```",
            "## Example: Log Retention in Production\n```yaml\nlimits_config:\n  # Global defaults\n  retention_period: 168h # 7 days default\n\n  # Per-stream retention based on importance\n  retention_stream_selectors:\n    - '{app=\"payment-service\"}': 2160h    # 90 days for payment logs\n    - '{app=\"auth-service\"}': 720h        # 30 days for auth logs\n    - '{level=\"error\"}': 720h             # 30 days for all errors\n    - '{env=\"development\"}': 72h          # 3 days for dev environment\n\ncompactor:\n  working_directory: /loki/compactor\n  shared_store: s3\n  retention_enabled: true\n  retention_delete_delay: 2h\n  compaction_interval: 10m\n  \nstorage_config:\n  aws:\n    s3: s3://logs-bucket\n    region: us-west-2\n    bucketnames: logs-bucket\n    access_key_id: ${AWS_ACCESS_KEY_ID}\n    secret_access_key: ${AWS_SECRET_ACCESS_KEY}\n    s3forcepathstyle: true\n    insecure: false\n```"
          ]
        }
      ],
      "map": []
    },
    "sources": {
      "https://grafana.com/docs/loki/latest/operations/storage/retention/": {
        "title": "Log retention",
        "hostname": "grafana.com",
        "age": [
          "Wednesday, April 12, 2023",
          "2023-04-12",
          "1266 days ago",
          "2023-04-12T00:00:00Z"
        ],
        "snippet": "on the object store TTL feature, and will work for both boltdb-shipper store and chunk/index stores. In order to enable the retention support, the Table Manager needs to be configured to enable deletions and a retention period."
      },
      "https://github.com/grafana/loki/blob/main/docs/sources/operations/storage/retention.md": {
        "title": "loki/docs/sources/operations/storage/retention.md at main \u00b7 grafana/loki",
        "hostname": "github.com",
        "age": [],
        "snippet": "a short window of time in which to cancel chunk deletion in the case of a configuration mistake. By default, marker files are written to local disk, under <working_directory>/retention/<object_store_type>_<period_from_date>/markers/. Marker ..."
      },
      "https://stackoverflow.com/questions/73138278/why-my-loki-log-retention-is-not-working": {
        "title": "purge - why my Loki log retention is not working? - Stack Overflow",
        "hostname": "stackoverflow.com",
        "age": [
          "Wednesday, July 27, 2022",
          "2022-07-27",
          "1525 days ago",
          "2022-07-27T00:00:00Z"
        ],
        "snippet": "Actually, My goal is to deleted logs which are older than 12h, it should be deleted from grafana dashboard as well as from server storage because I m facing storage issues as my log are not deleting, and occupying huge space in server storage ..."
      },
      "https://grafana.com/docs/loki/latest/operations/storage/logs-deletion/": {
        "title": "Log entry deletion",
        "hostname": "grafana.com",
        "age": [
          "Wednesday, November 02, 2022",
          "2022-11-02",
          "1427 days ago",
          "2022-11-02T00:00:00Z"
        ],
        "snippet": "Enable log entry deletion by setting retention_enabled to true in the compactor\u2019s configuration (-compactor.retention-enabled on the command line). The tenant\u2019s deletion_mode must also be filter-only or filter-and-delete, which is the case ..."
      },
      "https://grafana.com/docs/loki/latest/": {
        "title": "Grafana Loki",
        "hostname": "grafana.com",
        "age": [
          "Thursday, June 23, 2022",
          "2022-06-23",
          "1559 days ago",
          "2022-06-23T00:00:00Z"
        ],
        "snippet": "Retention in Loki is handled by the Compactor, not by the ingester or storage backend directly. A few common reasons why old data persists even after configuring a retention period: retention_enabled: true must be set under the compactor block, ..."
      },
      "https://oneuptime.com/blog/post/2026-01-30-loki-retention-strategies/view": {
        "title": "How to Implement Loki Retention Strategies",
        "hostname": "oneuptime.com",
        "age": [
          "Friday, January 30, 2026",
          "2026-01-30",
          "242 days ago",
          "2026-01-30T00:00:00Z"
        ],
        "snippet": "Managing log retention in Grafana Loki requires understanding how Loki stores data and which components handle deletion. Unlike traditional databases where you simply set a TTL, Loki's architecture involves chunks, indexes, and a compactor service ..."
      },
      "https://www.reddit.com/r/grafana/comments/vf48rx/logs_being_deleted_from_loki/": {
        "title": "r/grafana on Reddit: Logs being deleted from Loki?",
        "hostname": "www.reddit.com",
        "age": [
          "Saturday, June 18, 2022",
          "2022-06-18",
          "1563 days ago",
          "2022-06-18T16:12:35Z"
        ],
        "snippet": "<h1 class=\"text-24-scalable xs:text-20-scalable\" dir=\"auto\">Solved<p dir=\"auto\"> This issue has been resolved. Reason: PEBCAK (usage or instant query type as opposed to Range) <h1 class=\"text-24-scalable xs:text-20-scalable\" dir=\"auto\">Original<p ..."
      },
      "https://medium.com/@aditya.hilman_10961/enabling-log-retention-in-loki-with-compactor-fe3de2002b47": {
        "title": "Enabling Log Retention in Loki with Compactor",
        "hostname": "medium.com",
        "age": [
          "Tuesday, December 03, 2024",
          "2024-12-03",
          "665 days ago",
          "2024-12-03T10:18:49Z"
        ],
        "snippet": "Efficient log management is essential as Kubernetes workloads grow in complexity. In a previous guide, we explored how to centralize logs using Loki, Promtail, and Grafana. But once logs start accumulating, controlling their retention becomes ..."
      },
      "https://community.grafana.com/t/how-to-set-up-log-retention-correctly/156719": {
        "title": "How to set up log retention correctly? - Grafana Loki - Grafana Labs Community Forums",
        "hostname": "community.grafana.com",
        "age": [
          "Monday, August 25, 2025",
          "2025-08-25",
          "400 days ago",
          "2025-08-25T11:52:40Z"
        ],
        "snippet": "I am trying to configure automatic log deletion and expect that space will be automatically freed in the chunks bucket on MinIO. However, with the settings I have applied, this does not happen."
      },
      "https://www.compilenrun.com/docs/observability/loki/advanced-features/log-retention/": {
        "title": "Log Retention",
        "hostname": "www.compilenrun.com",
        "age": [],
        "snippet": "Loki's approach to log retention is centered around the concept of \"chunks\" - compressed batches of log data that are stored and managed together. Log retention in Loki involves deciding when these chunks should be deleted or moved to different ..."
      }
    }
  }
}