To keep Scheer PAS API Management running stably, you need to do some housekeeping on a regular basis.

Deleting Metrics From OpenSearch

After some time, API Management metrics can take a considerable amount of disk space. You can easily delete data that you do not need from OpenSearch by using the OpenSearch API.

Login to the Log Analyzer and switch to the developer tools (Dev Tools).

Copy the following example requests into the Developer Tools:

GET _cat/indices/apiman_metrics?format=json'

GET apiman_metrics/_search
{
  "query": {
    "bool": {
      "must": [],
      "filter": [
        {
          "match_all": {}
        },
        {
          "range": {
            "requestStart": {
              "gte": "2023-01-02T22:00:00.000Z",
              "lte": "2023-02-03T21:59:59.999Z",
              "format": "strict_date_optional_time"
            }
          }
        }
      ],
      "should": [],
      "must_not": []
    }
  }
}

POST apiman_metrics/_delete_by_query
{
  "query": {
    "bool": {
      "must": [],
      "filter": [
        {
          "match_all": {}
        },
        {
          "range": {
            "requestStart": {
              "gte": "2022-05-02T22:00:00.000Z",
              "lte": "2022-05-03T21:59:59.999Z",
              "format": "strict_date_optional_time"
            }
          }
        }
      ],
      "should": [],
      "must_not": []
    }
  }
}

You can see the used disk space with the first GET request. Use the play button at the end of the line to run it.

  1. Query the data by pressing the play button at the end of the line, use the GET /_search endpoint.
    Change the date and time to the interval you want to delete later.
  2. Check if you really want to delete this data.
  3. Change the third request with the same time interval as your search from before.
    Use the play button at the end of the line to use the POST / _delete_by_query endpoint.
On this Page:

  • No labels