使用 Elasticsearch 配置 Heartbeat 以解析 Json 结果

Configure Heartbeat with Elasticsearch to parse Json Result

我已经配置了 elasticsearch、kibana 和 heartbeat,我确实看到了 "heartbeat" 下的结果。

但是无论我添加到监视器的处理器是什么,我都看不到任何额外的数据: https://www.elastic.co/guide/en/beats/heartbeat/current/add-tags.html

- type: http
  urls: ["http://localhost:8359/api/heartbeat"]
  schedule: '@every 10s'
  processors:
  - add_tags:
    tags: [web123, production123]

我想存储我在查询服务时得到的实际 JSON 响应:http://localhost:8359/api/heartbeat(不仅仅是 HTTP 200)。并想在 "Uptime" 部分

下的某个地方显示此响应

示例 json 来自端点的响应:

{
    "StatusCode": 2,
    "Messages": [
        "interface not found: MyTestService"
    ],
    "Type": "MyTestService",
    "IsValid": false
}

解决方案:

  schedule: '@every 2m'
  check.response: 
    status: 200
    json:
      - description: Json Response
        condition:
          equals:
            Status: Ok

其中 "Status" 是我要返回的 json 属性之一。