github.com/muhammadn/cortex@v1.9.1-0.20220510110439-46bb7000d03d/docs/guides/deleting-series.md (about)

     1  ---
     2  title: "Deleting Series"
     3  linkTitle: "Deleting Series"
     4  weight: 10
     5  slug: deleting-series
     6  ---
     7  
     8  _This feature is currently experimental and is only supported for Chunks storage (deprecated)._
     9  
    10  Cortex supports deletion of series using [Prometheus compatible API](https://prometheus.io/docs/prometheus/latest/querying/api/#delete-series).
    11  It however does not support [Prometheuses Clean Tombstones](https://prometheus.io/docs/prometheus/latest/querying/api/#clean-tombstones) API because Cortex uses a different mechanism to manage deletions.
    12  
    13  ### How it works
    14  
    15  A new service called `purger` is added which exposes deletion APIs and does the processing of the requests.
    16  To store the requests, and some additional information while performing deletions, the purger requires configuring an index and object store respectively for it.
    17  For more information about the `purger` configuration, please refer to the [config file reference](../configuration/config-file-reference.md#purger_config) documentation.
    18  
    19  All the requests specified below needs to be sent to `purger`.
    20  
    21  **Note:** If you have enabled multi-tenancy in your Cortex cluster then deletion APIs requests require to have the `X-Scope-OrgID` header set like for any other Cortex API.
    22  
    23  #### Requesting Deletion
    24  
    25  By calling the `/api/v1/admin/tsdb/delete_series` API like how it is done in [Prometheus](https://prometheus.io/docs/prometheus/latest/querying/api/#delete-series), you can request the deletion of series.
    26  Delete Series requests are immediately honored by eliminating series requested for deletion from query responses without actually deleting them from storage.
    27  The actual data is not deleted from storage until period configured for `-purger.delete-request-cancel-period` CLI flag or its respective YAML config option which helps operators take informed decision about continuing with the deletion or cancelling the request.
    28  
    29  Cortex would keep eliminating series requested for deletion until the `purger` is done processing the delete request or the delete request gets cancelled.
    30  
    31  _Sample cURL command:_
    32  ```
    33  curl -X POST \
    34    '<purger_addr>/api/v1/admin/tsdb/delete_series?match%5B%5D=up&start=1591616227&end=1591619692' \
    35    -H 'x-scope-orgid: <tenant-id>'
    36  ```
    37  
    38  #### Cancellation of Delete Request
    39  
    40  Cortex allows cancellation of delete requests until they are not picked up for processing, which is controlled by the `-purger.delete-request-cancel-period` CLI flag or its respective YAML config option.
    41  Since Cortex does query time filtering of data request for deletion until it is actually deleted, you can take an informed decision to cancel the delete request by calling the API defined below:
    42  
    43  ```
    44  POST /api/v1/admin/tsdb/cancel_delete_request?request_id=<request_id>
    45  PUT /api/v1/admin/tsdb/cancel_delete_request?request_id=<request_id>
    46  ```
    47  
    48  _Sample cURL command:_
    49  ```
    50  curl -X POST \
    51    '<purger_addr>/api/v1/admin/tsdb/cancel_delete_request?request_id=<request_id>' \
    52    -H 'x-scope-orgid: <tenant-id>'
    53  ```
    54  
    55  You can find the id of the request that you want to cancel by using the GET `delete_series` API defined below.
    56  
    57  #### Listing Delete Requests
    58  
    59  You can list the created delete requests using following API:
    60  
    61  ```
    62  GET /api/v1/admin/tsdb/delete_series
    63  ```
    64  
    65  _Sample cURL command:_
    66  ```
    67  curl -X GET \
    68    <purger_addr>/api/v1/admin/tsdb/delete_series \
    69    -H 'x-scope-orgid: <orgid>'
    70  ```
    71  
    72  **NOTE:** List API returns both processed and un-processed requests except the cancelled ones since they are removed from the store.
    73