Failed to get my heatbeat.yml to be used

Tried it, but the pings (actually received to my clud instance) were to the default heartbeat.yml (2 http 2 icmp) inside the container (I believe that is what happened).

In examples\docker\heartbeat.docker.yml:

- type: browser
  id: my-monitor
  name: My Monitor
  schedule: "@every 1m"
  script: |-
    step("load homepage", async () => {
        await page.goto('');
    step("Tryck till kundtjanst", async () => {
        await'title=["Till kundservice"]');


In examples\

set -e
set -x
if [ ! -z $1 ]; then
  shift # discard first arg

if [ -z $1 ]; then
  HEARTBEAT_ARGS="-E output.elasticsearch.hosts=["localhost:9200"] -E output.elasticsearch.username=elastic -E output.elasticsearch.password=changeme"

# Set Image based on version
if [[ $VERSION =~ ^[0-9] ]]; then$VERSION-synthetics

echo "Using image '$IMAGE' with extra args: $HEARTBEAT_ARGS"
docker run \
  --rm \
  --name=heartbeat \
  --user=heartbeat \
  --net=host \
  --security-opt seccomp=seccomp_profile.json \
  --volume="$(pwd)/heartbeat.docker.yml:/usr/share/heartbeat/heartbeat.yml:ro" \
  --volume="$(pwd)/../../:/opt/elastic-synthetics:rw" \
  $IMAGE \
  --strict.perms=false -e \
  -E" \
  -E cloud.auth="elastic:xxx"

from examples\docker I start /(w10) using
sh 7.10.0
At starts up, the data is send to my cloud but always for

Why is not my heartbeat.yml used??

@Fredrik_Cronholm if you want to change where you want to send data you will have to specify those options while running your command

like this

sh 7.10.0 -E output.elasticsearch.hosts=["localhost:9200"] -E

same way you can specify other options -E or -E cloud.auth or -E output.elasticsearch.username=elastic etc

let me know if it works.

That works, the data is sent to the correct place. It is the tests that is not used (the content of heartbeat.docker.yml)

I guess you can retry creating your container. That might help, we will try to reproduce this locally.

I'm not super used to docker, I have rerun sh a few times, no difference. I have also tried to copy the local config file to the container (as in the scrip), docker cp to /usr/share/heartbeat/heartbeat.yml but the same result.
Waiting for a possible resolution. I'm thinking my test file has some syntax errors and is therefore not used..?

Are you running from the synthetics/examples/docker folder on your clone of the repo?

This should run the docker version of Elastic Synthetics, taking the configuration from your local synthetics/examples/heartbeat.docker.yml file (i.e. this is the one you want to edit to contains your URLs and script).

Try making sure you are in the synthetics/examples/docker folder when you run so that it can mount the correct synthetics/examples/heartbeat.docker.ymlfile inside your docker container.

Yes I run it locally on my host in the cloned repo :frowning:

The mounting of your local heartbeat.docker.yml into the docker container works the same for regular Heartbeat (e.g. standard HTTP pings) as well as for the Synthetics implementation (i.e. it uses the same mechanism for getting your local heartbeat.docker.yml into the docker container).

It might be worth starting again to make sure you have a clean set up. Remove your clone of the Synthetics repository (backing up anything you may want to keep), then clone a new/up to date copy (git clone

Before running it, also remove any docker images you may have (this will make sure it downloads the latest version when you next run). You can run docker images to see what images you have.

If you have anything like or 7.10.0-synthetics, remove it with docker image rm IMAGE_ID, substituting the IMAGE_ID with what was listed for the image.

Add your Elasticsearch host/credentials to the synthetics/examples/docker/ file as you did before. Don’t modify the heartbeat.docker.yml file yet.

Make sure you are in the synthetics/examples/docker folder, then run the ./ 7.10.0 command, this will take a bit longer and download all the docker images needed. Check that this is running correctly.

If so, stop it ([ctrl][c]) then add your monitor configuration to the heartbeat.docker.yml and run ./ 7.10.0 again to see if it runs with your monitors this time.

Did as described (removed all images, clones new, started etc. etc). Still difference. Still doesn't check the site (as described in the original heartbeat.docker.yml). It still checks 4 localhost adresses.

Hi @Fredrik_Cronholm,

Is it possible for you to post part of the logs from the docker container?
You can use this command to get the logs: docker logs --tail=50 <container-id>.


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