When using a HTTP Heartbeat (6.4.0 on Centos 7.5) I'm finding it works fine if I only check the response status, but if I include a check on the response body I always get an error about "use of closed network connection". Have tested with several HTTPS and plain HTTP web sites.
Any suggestions please?
heartbeat.yml:
output.elasticsearch:
hosts:
- ******
heartbeat.monitors:
- type: http
schedule: 30 * * * * * *
urls:
- https://www.elastic.co/
check.request:
method: GET
check.response:
status: 200
body: Elasticsearch
logging.level: debug
heartbeat -c /etc/heartbeat/heartbeat.yml -e -d "*":
2018-09-10T13:44:58.219+1200 INFO instance/beat.go:544 Home path: [/usr/share/heartbeat] Config path: [/etc/heartbeat] Data path: [/var/lib/heartbeat] Logs path: [/var/log/heartbeat]
2018-09-10T13:44:58.220+1200 DEBUG [beat] instance/beat.go:571 Beat metadata path: /var/lib/heartbeat/meta.json
2018-09-10T13:44:58.220+1200 INFO instance/beat.go:551 Beat UUID: 04263c29-1ff6-49b7-b439-c11d3f1a6ed1
...
2018-09-10T13:44:58.220+1200 INFO [seccomp] seccomp/seccomp.go:116 Syscall filter successfully installed
2018-09-10T13:44:58.220+1200 INFO [beat] instance/beat.go:768 Beat info {"system_info": {"beat": {"path": {"config": "/etc/heartbeat", "data": "/var/lib/heartbeat", "home": "/usr/share/heartbeat", "logs": "/var/log/heartbeat"}, "type": "heartbeat", "uuid": "04263c29-1ff6-49b7-b439-c11d3f1a6ed1"}}}
2018-09-10T13:44:58.220+1200 INFO [beat] instance/beat.go:777 Build info {"system_info": {"build": {"commit": "34b4e2cc75fbbee5e7149f3916de72fb8892d070", "libbeat": "6.4.0", "time": "2018-08-17T22:21:25.000Z", "version": "6.4.0"}}}
2018-09-10T13:44:58.220+1200 INFO [beat] instance/beat.go:780 Go runtime info {"system_info": {"go": {"os":"linux","arch":"amd64","max_procs":2,"version":"go1.10.3"}}}
2018-09-10T13:44:58.222+1200 INFO [beat] instance/beat.go:784 Host info {"system_info": {"host": {"architecture":"x86_64","boot_time":"2018-09-05T09:39:16+12:00","containerized":true,"hostname":"elk","ips":["127.0.0.1/8","::1/128","10.0.2.15/24","fe80::a00:27ff:fe01:ab81/64","10.0.0.28/24","fe80::a00:27ff:fee7:9368/64"],"kernel_version":"3.10.0-862.9.1.el7.x86_64","mac_addresses":["08:00:27:01:ab:81","08:00:27:e7:93:68"],"os":{"family":"redhat","platform":"centos","name":"CentOS Linux","version":"7 (Core)","major":7,"minor":5,"patch":1804,"codename":"Core"},"timezone":"NZST","timezone_offset_sec":43200,"id":"4454d823e45548f38c7966cdf2c87d26"}}}
...
2018-09-10T13:45:31.025+1200 DEBUG [publish] pipeline/processor.go:308 Publish event: {
"@timestamp": "2018-09-10T01:45:30.000Z",
"@metadata": {
"beat": "heartbeat",
"type": "doc",
"version": "6.4.0"
},
"beat": {
"name": "elk",
"hostname": "elk",
"version": "6.4.0"
},
"host": {
"name": "elk"
},
"monitor": {
"type": "http",
"ip": "151.101.166.217",
"host": "www.elastic.co",
"duration": {
"us": 1024862
},
"status": "down",
"scheme": "https",
"id": "http@https://www.elastic.co/",
"name": "http"
},
"resolve": {
"ip": "151.101.166.217",
"rtt": {
"us": 33366
},
"host": "www.elastic.co"
},
"error": {
"message": "read tcp 10.0.2.15:48400->151.101.166.217:443: use of closed network connection",
"type": "validate"
},
"tcp": {
"port": 443,
"rtt": {
"connect": {
"us": 14068
}
}
},
"tls": {
"rtt": {
"handshake": {
"us": 47384
}
}
},
"http": {
"response": {
"status_code": 200
},
"rtt": {
"validate": {
"us": 929890
},
"content": {
"us": 110
},
"total": {
"us": 991436
},
"write_request": {
"us": 79
},
"response_header": {
"us": 929779
}
},
"url": "https://www.elastic.co/"
}
}
2018-09-10T13:45:31.025+1200 DEBUG [scheduler] scheduler/scheduler.go:225 Job 'http@https://www.elastic.co/' returned at 2018-09-10 13:45:31.025668512 +1200 NZST m=+32.815560624 (cont=0).