Heartbeat - how to send respone.status field to kibana to get URL status

I have heartbeat for checking URL availability and data is available in Kibana. I have to create the line graph (trend chart) to see the URL status in the graph. Since there is no direct way, i am trying to use the moving average of response.status of the URL. The yml configuration I have is like below.

heartbeat.monitors:
- type: http
  urls: ["https://target-server.domain.com/jenkins"]
  schedule: '@every 60s'
  #timeout: 16s
#Request settings:
  check.request:
    method: "GET"
  check.response:
    status: 200
output.console:
   pretty: true
output.logstash:
   hosts: ["target-server.domain.com:5044"]
logging.level: debug

But I am not seeing the response.status (like 200 or 503 or 301 etc) in the Kibana. I looked at heartbeat logs and i see the response.status is available in logs for ONLY success value 200. However, if the url is not reachable then it is not showing the error response(503 or any other return status) in the log, instead seeing the message like "received status code 403 expecting 200".

2017-05-25T08:06:23-06:00 DBG  Publish: {
  "@timestamp": "2017-05-25T14:06:21.446Z",
  "beat": {
    "hostname": "client-server.domain.com",
    "name": "client-server.domain.com",
    "version": "5.4.0"
  },
  "duration": {
    "us": 1807796
  },
  "error": {
    "message": "received status code 403 expecting 200",
    "type": "validate"
  },
  "host": "target-server.domain.com",
  "http_rtt": {
    "us": 232620
  },
  "ip": "100.24.140.10",
  "monitor": "http@https://target-server.domain.com/jenkins",
  "port": 443,
  "resolve_rtt": {
    "us": 55046
  },
  "scheme": "https",
  "tcp_connect_rtt": {
    "us": 206545
  },
  "tls_handshake_rtt": {
    "us": 436622
  },
  "type": "http",
  "up": false,
  "url": "https://target-server.domain.com/jenkins"
}

In both the case (success and failure) i am not seeing the respose.status in the kibana. I believe this can be done using check.response because when we are checking the status we need a way to get the response/return code or error from URL in kibana for report generation. Am i missing anything in the code and please correct me if I have understood wrongly.

The heartbeat event format has recently been reworked: https://github.com/elastic/beats/pull/4091

The alpha versions or nightly builds should also report the status code

Thanks Steefens. I have the response.status for the urls now working as expected.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.