github.com/yankunsam/loki/v2@v2.6.3-0.20220817130409-389df5235c27/docs/sources/operations/storage/logs-deletion.md (about) 1 --- 2 title: Log entry deletion 3 menuTitle: "Log entry deletion" 4 description: "Log entries from a specified stream may be deleted." 5 weight: 60 6 --- 7 # Log entry deletion 8 9 Grafana Loki supports the deletion of log entries from a specified stream. 10 Log entries that fall within a specified time window and match an optional line filter are those that will be deleted. 11 12 Log entry deletion is supported _only_ when the BoltDB Shipper is configured for the index store. 13 14 The compactor component exposes REST [endpoints](../../../api/#compactor) that process delete requests. 15 Hitting the endpoint specifies the streams and the time window. 16 The deletion of the log entries takes place after a configurable cancellation time period expires. 17 18 Log entry deletion relies on configuration of the custom logs retention workflow as defined for the [compactor](../retention#compactor). The compactor looks at unprocessed requests which are past their cancellation period to decide whether a chunk is to be deleted or not. 19 20 ## Configuration 21 22 Enable log entry deletion by setting `retention_enabled` to true in the compactor's configuration and setting and `deletion_mode` to `filter-only` or `filter-and-delete` in the runtime config. 23 24 Because it is a runtime configuration, `deleteion_mode` can be set per-tenant, if desired. 25 26 With `filter-only`, log lines matching the query in the delete request are filtered out when querying Loki. They are not removed from storage. 27 With `filter-and-delete`, log lines matching the query in the delete request are filtered out when querying Loki, and they are also removed from storage. 28 29 A delete request may be canceled within a configurable cancellation period. Set the `delete_request_cancel_period` in the compactor's YAML configuration or on the command line when invoking Loki. Its default value is 24h. 30 31 As long as the `compactor.retention_enabled` setting is `true`, the API endpoints will be available. Afterwards, access to the deletion API can be enabled per tenant via the `deletion_mode` tenant override.