# Using Heartbeat as a Speed Test

**URL:** <https://discuss.elastic.co/t/using-heartbeat-as-a-speed-test/154931>\
**Category:** Beats\
**Tags:** heartbeat\
**Created:** [October 31, 2018, 9:37pm UTC](https://discuss.elastic.co/t/using-heartbeat-as-a-speed-test/154931 "2018-10-31T21:37:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Josiah\_Raiche](https://avatars.discourse-cdn.com/v4/letter/j/51bf81/32.png) [@Josiah\_Raiche](https://discuss.elastic.co/u/Josiah_Raiche)\
**Post date:** [October 31, 2018, 9:37pm UTC](https://discuss.elastic.co/t/using-heartbeat-as-a-speed-test/154931/1 "2018-10-31T21:37:42Z")

</div>

I'm trying to use Heartbeat to roughly check intranet speed. I have a large file on an internal server and I can reach it with heartbeat.

I'm testing on a slow internet connection. In the browser it takes over a minute to load this file. Heartbeat is reporting total time `monitor.duration.us` as 1 second or less.

I've tried the following configuration:

```auto
heartbeat.monitors:
- type: http
  name: "Big File"
  urls: ["http://path/to/bluemarble.jpg"]
  schedule: '@every 30s'
  check.request:
    method: GET

```

## Stuff I've tried:

I attempted to set the method just in case it was trying to do a `HEAD` request.

I tried also using a regex like so to ensure the content was long, but got a TCP error:

```auto
check.response:
    body: '.{500,}'
[...]

> error.message: "read tcp [ipv6]:port->[ipv6]:port: use of closed network connection"

```

I also tried adding a timestamp to the url to prevent caching, but the variable didn't expand:

```auto
  urls: ["http://aotapps/speedtest/bluemarble.jpg%{+yyyy.MM.ddThh:mm:ss}"]

> monitor.url: "http://path/to/bluemarble.jpg?t=%{+yyyy.MM.ddThh:mm:ss}"

```

I suspect that it's only reading the first TCP frame and/or using a cached response for the content.

I'm not even sure if I'm on the right track - has anyone done this or suggest how it might be possible? Ideally I'd like to use `[fixed file size] / http.rtt.content.us` as my speed metric.

---

<div class="post-metadata">

**Author:** ![Andrew\_Cholakian1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrew_cholakian1/32/3612_2.png) [@Andrew\_Cholakian1](https://discuss.elastic.co/u/Andrew_Cholakian1)\
**Post date:** [October 31, 2018, 10:16pm UTC](https://discuss.elastic.co/t/using-heartbeat-as-a-speed-test/154931/2 "2018-10-31T22:16:07Z")

</div>

Hey, thanks for writing.

So, the good news is this should work. The bad news is that there's a bug preventing it from working. The bug, which you found, is that we prematurely close large bodies before finishing reading them.

[https://github.com/elastic/beats/pull/8660](https://github.com/elastic/beats/pull/8660) fixed it. It's set to be released in 6.5.0 . There's always a small chance that any feature could be pulled before release, but that is not very likely in this case.

---

<div class="post-metadata">

**Author:** ![Andrew\_Cholakian1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrew_cholakian1/32/3612_2.png) [@Andrew\_Cholakian1](https://discuss.elastic.co/u/Andrew_Cholakian1)\
**Post date:** [November 1, 2018, 3:22pm UTC](https://discuss.elastic.co/t/using-heartbeat-as-a-speed-test/154931/3 "2018-11-01T15:22:35Z")

</div>

we also have 6.x package builds here: [https://beats-ci.elastic.co/job/elastic+beats+6.x+multijob-package-linux/gcsObjects/](https://beats-ci.elastic.co/job/elastic+beats+6.x+multijob-package-linux/gcsObjects/)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 29, 2018, 3:22pm UTC](https://discuss.elastic.co/t/using-heartbeat-as-a-speed-test/154931/4 "2018-11-29T15:22:40Z")

</div>

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