# Heartbeat config files fail when path variables passed

**URL:** <https://discuss.elastic.co/t/heartbeat-config-files-fail-when-path-variables-passed/289890>\
**Category:** Beats\
**Tags:** heartbeat\
**Created:** [November 23, 2021, 1:11am UTC](https://discuss.elastic.co/t/heartbeat-config-files-fail-when-path-variables-passed/289890 "2021-11-23T01:11:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![DPattee](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dpattee/32/37772_2.png) [@DPattee](https://discuss.elastic.co/u/DPattee)\
**Post date:** [November 23, 2021, 1:11am UTC](https://discuss.elastic.co/t/heartbeat-config-files-fail-when-path-variables-passed/289890/1 "2021-11-23T01:11:10Z")

</div>

In order to get my Kibana https heartbeat working, I had to add the standard ssl blob. I used the same blob that I have in all my .yml's that lets everything successfully (mostly) talk over https:

```auto
  ssl.enabled: true
  ssl:
    certificate_authorities: ["${path.config}/elasticsearch-ca.pem"]
    verification_mode: "none"

```

But, that ended up causing the heartbeat to stop parsing that set of configs, instead spewing logs of:

```auto
2021-11-22T16:17:05.278-0800	ERROR	[reload]	cfgfile/list.go:69	Unable to hash given config: missing field accessing '0.ssl' (source:'/blahblah/elastic-configs/heartbeat/heartbeat-monitors/kibana.http.yml')

```

That error message was not informative beyond "something is wrong with the ssl section"... Some googling found a few other people with similar "unable to hash" errors, so I tried a few of the solutions.

The one that worked was replacing ${path.config}/Elasticsearch-ca.pem with the full hardcoded path to that file.

That works, as a temporary measure. But since that path isn't the same across all machines (and I use common config files that get synced to maintain my sanity) it isn't a good long term solution.

The common beat variables need to be properly parsed when they are in the module-specific ymls

---

<div class="post-metadata">

**Author:** ![kvch](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kvch/32/72058_2.png) [@kvch](https://discuss.elastic.co/u/kvch)\
**Post date:** [November 23, 2021, 1:06pm UTC](https://discuss.elastic.co/t/heartbeat-config-files-fail-when-path-variables-passed/289890/2 "2021-11-23T13:06:02Z")

</div>

Could you please share all of your configuration files? I have tried to reproduce your issue with a minimal configuration, but for me it is working as expected.

---

<div class="post-metadata">

**Author:** ![DPattee](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dpattee/32/37772_2.png) [@DPattee](https://discuss.elastic.co/u/DPattee)\
**Post date:** [November 23, 2021, 7:45pm UTC](https://discuss.elastic.co/t/heartbeat-config-files-fail-when-path-variables-passed/289890/3 "2021-11-23T19:45:17Z")

</div>

Directory layout:

```auto
/usr/local/opt/heartbeat-full/<the app install>
/foo/elastic-configs/heartbeat/
/foo/elastic-configs/heartbeat/elasticsearch-ca.pem
/foo/elastic-configs/heartbeat/heartbeat-monitors/
/foo/elastic-configs/heartbeat/heartbeat-monitors/servers.icmp.yml
/foo/elastic-configs/heartbeat/heartbeat-monitors/kibana.http.yml

```

launch command:

`/usr/local/opt/heartbeat-full/bin/heartbeat --path.config /foo/elastic-configs/heartbeat -c my-heartbeat-config.yml`

Main config:

```auto
heartbeat.config.monitors:
  # Directory + glob pattern to search for configuration files
  path: ${path.config}/heartbeat-monitors/*.yml
  reload.enabled: true
  reload.period: 300s

output.elasticsearch:
  # Array of hosts to connect to.
  hosts: ["headnode.hostname:9200"]
  protocol: "https"
  username: "heartbeat_user"
  password: "password"
  ssl:
    certificate_authorities: ["${path.config}/elasticsearch-ca.pem"]
    verification_mode: "none"

  max_retries: 5
  backoff.max: 120s
  timeout: 120

processors:
  - add_locale:
      format: offset

processors:
  - add_host_metadata:
      netinfo.enabled: true

logging.level: warning

http.enabled: true
http.port: 5069

```

https monitor config:

```auto
- type: http 
  id: my-kibana-http-monitor

  name: My Kibana HTTP Monitor

  schedule: '@every 10m' # every 5 seconds from start of beat

  hosts: ["https://kibana.hostname:5601"]

  ipv4: true
  mode: any

  ssl.enabled: true
  ssl:
    certificate_authorities: ["/foo/elastic-configs/heartbeat/elasticsearch-ca.pem"]
    verification_mode: "none"

```

And the only change required to break/fix the errors (which of course totally block that monitor from working, though naturally the server ping module that doesn't require any kind of ssl continues to work through) is flopping between:

`certificate_authorities: ["/foo/elastic-configs/heartbeat/elasticsearch-ca.pem"]`

and  
` certificate_authorities: ["${path.config}/elasticsearch-ca.pem"]`

in the https monitor config. The variable expansion works properly in the main heartbeat config.

---

<div class="post-metadata">

**Author:** ![DPattee](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dpattee/32/37772_2.png) [@DPattee](https://discuss.elastic.co/u/DPattee)\
**Post date:** [December 10, 2021, 6:42pm UTC](https://discuss.elastic.co/t/heartbeat-config-files-fail-when-path-variables-passed/289890/4 "2021-12-10T18:42:18Z")

</div>

This problem repros on multiple Mac machines and I think one of my raspberry pi's but I'd need to double check that one

---

<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:** [January 7, 2022, 8:42pm UTC](https://discuss.elastic.co/t/heartbeat-config-files-fail-when-path-variables-passed/289890/5 "2022-01-07T20:42:27Z")

</div>

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