如何在Elastic APM中删除服务?

时间:2019-09-24 06:23:05

标签: elasticsearch elastic-stack apm

我正在尝试弹性APM。我已经成功创建了一个流入数据的服务。我想看看我是否可以拥有多个服务。不知何故,我遇到了问题,因此我想删除一些服务。但是,我找不到删除服务的方法。

enter image description here

问题:如何在APM中删除服务?

其他信息

与APM相关的索引:

enter image description here

{
  "_index": "apm-7.3.2-metric-000001",
  "_type": "_doc",
  "_id": "XgEhYm0BiAdOXLlDGc-r",
  "_version": 1,
  "_score": null,
  "_source": {
    "jvm": {
      "memory": {
        "non_heap": {
          "committed": 87449600,
          "max": -1,
          "used": 66599704
        },
        "heap": {
          "committed": 232783872,
          "max": 2025848832,
          "used": 170023936
        }
      },
      "thread": {
        "count": 63
      },
      "gc": {
        "alloc": 632406344
      }
    },
    "observer": {
      "hostname": "localhost.localdomain",
      "id": "d1aec10a-cc4e-44f4-9aed-acf57d107ab7",
      "ephemeral_id": "ae48b040-f9f6-4144-a600-d402defaa44a",
      "type": "apm-server",
      "version": "7.3.2",
      "version_major": 7
    },
    "agent": {
      "name": "java",
      "ephemeral_id": "66d5c439-271c-483d-a426-d0e569bede4a",
      "version": "1.9.0"
    },
    "process": {
      "pid": 16154,
      "title": "/usr/lib/jvm/java-11-openjdk-11.0.1.13-3.el7_6.x86_64/bin/java",
      "ppid": 1
    },
    "@timestamp": "2019-09-24T07:16:28.461Z",
    "system": {
      "process": {
        "memory": {
          "size": 6070763520
        },
        "cpu": {
          "total": {
            "norm": {
              "pct": 0.001925814284518128
            }
          }
        }
      },
      "memory": {
        "actual": {
          "free": 749580288
        },
        "total": 8102449152
      },
      "cpu": {
        "total": {
          "norm": {
            "pct": 0.033324960227748474
          }
        }
      }
    },
    "ecs": {
      "version": "1.0.1"
    },
    "service": {
      "name": "ldap1",
      "runtime": {
        "name": "Java",
        "version": "11.0.1"
      },
      "language": {
        "name": "Java",
        "version": "11.0.1"
      }
    },
    "host": {
      "hostname": "localhost.localdomain",
      "os": {
        "platform": "Linux"
      },
      "ip": "127.0.0.1",
      "architecture": "amd64"
    },
    "processor": {
      "name": "metric",
      "event": "metric"
    }
  },
  "fields": {
    "@timestamp": [
      "2019-09-24T07:16:28.461Z"
    ]
  },
  "sort": [
    1569309388461
  ]
}

以上包含我要删除的服务。

"service": {
      "name": "ldap1",
      "runtime": {
        "name": "Java",
        "version": "11.0.1"
      },

2 个答案:

答案 0 :(得分:2)

您只需要将查询更改为此:

POST apm*/_delete_by_query
{
  "query": {
     "term": {
       "service.name": "ldap1"
     }
  }
}

答案 1 :(得分:2)

接受的答案不再有效,您可以使用以下内容

POST /apm-*/_delete_by_query
{
  "query": {
"bool": {
  "must": [
    {
      "term": {
        "service.name": {
          "value": "my-application"
        }
      }
    }
  ]
}
  }
}