# Elastic Lightweight Monitor: ${host.name} no longer using current host name

**URL:** <https://discuss.elastic.co/t/elastic-lightweight-monitor-host-name-no-longer-using-current-host-name/366421>\
**Category:** Synthetics\
**Created:** [September 11, 2024, 4:05pm UTC](https://discuss.elastic.co/t/elastic-lightweight-monitor-host-name-no-longer-using-current-host-name/366421 "2024-09-11T16:05:56Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![DougR](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dougr/32/48095_2.png) [@DougR](https://discuss.elastic.co/u/DougR)\
**Post date:** [September 11, 2024, 4:05pm UTC](https://discuss.elastic.co/t/elastic-lightweight-monitor-host-name-no-longer-using-current-host-name/366421/1 "2024-09-11T16:05:56Z")

</div>

I am deploying a lightweight project monitor to multiple hosts to check for the availability of a specific port on that host. Previously, the following worked:

```yaml
heartbeat.monitors:
  - id: '09eb9559-ee3b-475f-ac4f-4f264f11318e'
    name: 'myapp'
    type: 'tcp'
    enabled: true
    alert.status.enabled: false
    hosts: 'https://${host.name}:8443'
    schedule: '@every 1m'
    timeout: '15s'
    privateLocations: ['my_private_location']

```

However, sometime fairly recently, it appears to have stopped parsing `${host.name}` as the current host name, and I am getting the following error:

```auto
job could not be initialized: could not parse tcp host 'https://:8443'

```

I suspect that this means that it's trying to read `${host.name}` as a parameter.

Because of the configuration of the web servers, I'm unable to use `localhost:8443` as my address. Additionally, were I to do this, it would report the hostname as `localhost` for any alerts generated.

Is there any corresponding functionality for this? Am I able to do something like `${env.HOSTNAME}`?

I'm currently using 8.15.1. This started sometime on 29 Aug, which appears to be when I upgraded my nodes to 8.15.0.

Thx!

---

<div class="post-metadata">

**Author:** ![Alex\_Salgado-Elastic](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alex_salgado-elastic/32/103081_2.png) [@Alex\_Salgado-Elastic](https://discuss.elastic.co/u/Alex_Salgado-Elastic)\
**Post date:** [September 11, 2024, 5:49pm UTC](https://discuss.elastic.co/t/elastic-lightweight-monitor-host-name-no-longer-using-current-host-name/366421/3 "2024-09-11T17:49:51Z")

</div>

Which operating system are you using?

---

<div class="post-metadata">

**Author:** ![DougR](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dougr/32/48095_2.png) [@DougR](https://discuss.elastic.co/u/DougR)\
**Post date:** [September 11, 2024, 5:51pm UTC](https://discuss.elastic.co/t/elastic-lightweight-monitor-host-name-no-longer-using-current-host-name/366421/4 "2024-09-11T17:51:20Z")

</div>

> [@Alex\_Salgado-Elastic](#):
>
> Which operating system are you using?

Forgot that (sorry)...I'm seeing this in both Linux and Windows, but Windows is the more urgent of the two.

---

<div class="post-metadata">

**Author:** ![shahzad31](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shahzad31/32/51637_2.png) [@shahzad31](https://discuss.elastic.co/u/shahzad31)\
**Post date:** [September 11, 2024, 7:17pm UTC](https://discuss.elastic.co/t/elastic-lightweight-monitor-host-name-no-longer-using-current-host-name/366421/5 "2024-09-11T19:17:08Z")

</div>

I am not sure what has been changed recently that would change the behaviour, let me see if there is any escape hatch. From which version did you upgrade?

---

<div class="post-metadata">

**Author:** ![shahzad31](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shahzad31/32/51637_2.png) [@shahzad31](https://discuss.elastic.co/u/shahzad31)\
**Post date:** [September 12, 2024, 8:46am UTC](https://discuss.elastic.co/t/elastic-lightweight-monitor-host-name-no-longer-using-current-host-name/366421/6 "2024-09-12T08:46:52Z")

</div>

Based on unit tests i have seen in code, behaviour has always been same though i believe it makes sense to not replace missing values, so i have made the PR to change it, most likely it will make 8.15.2 if got merged in time

> <https://github.com/elastic/kibana/pull/192662>
>
> \## Summary
> 
> Based on user reported issue in https://discuss.elastic.co/t/elast…ic-lightweight-monitor-host-name-no-longer-using-current-host-name/366421
> 
> Update parsing to skip replacing missing values !!
> 
> \### Before
> 
> https://${host.name} would be replaced with "https://",
> 
> 
> \### After
> Var value remain as is so that it would look for env variable 
> "https://${host.name}", 
> 
> 
> \### Testing
> 
> can be tested in the ui , go to add monitor ui , user params in url field and use inspect configuration to see parsed value, enabled inspect button from kibana advanced settings observability inspect ES queries !!
> 
> \<img width="852" alt="image" src="https://github.com/user-attachments/assets/66bf460a-7d63-4fb3-993d-1caaa6812583"\>
> 
> 
> \<img width="1106" alt="image" src="https://github.com/user-attachments/assets/6f5e97c6-182a-4cd1-a345-976c321d449a"\>

---

<div class="post-metadata">

**Author:** ![DougR](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dougr/32/48095_2.png) [@DougR](https://discuss.elastic.co/u/DougR)\
**Post date:** [September 12, 2024, 12:46pm UTC](https://discuss.elastic.co/t/elastic-lightweight-monitor-host-name-no-longer-using-current-host-name/366421/7 "2024-09-12T12:46:26Z")

</div>

> [@shahzad31](#):
>
> I am not sure what has been changed recently that would change the behaviour, let me see if there is any escape hatch. From which version did you upgrade?

I just updated from 8.15.0, updated to that from 8.14.3, when I believe it was working correctly.

---

<div class="post-metadata">

**Author:** ![shahzad31](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shahzad31/32/51637_2.png) [@shahzad31](https://discuss.elastic.co/u/shahzad31)\
**Post date:** [September 12, 2024, 1:07pm UTC](https://discuss.elastic.co/t/elastic-lightweight-monitor-host-name-no-longer-using-current-host-name/366421/8 "2024-09-12T13:07:23Z")

</div>

i will test on 8.14.3 and report back.

---

<div class="post-metadata">

**Author:** ![shahzad31](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shahzad31/32/51637_2.png) [@shahzad31](https://discuss.elastic.co/u/shahzad31)\
**Post date:** [September 13, 2024, 8:11am UTC](https://discuss.elastic.co/t/elastic-lightweight-monitor-host-name-no-longer-using-current-host-name/366421/9 "2024-09-13T08:11:42Z")

</div>

i tested again on 8.14.3 and as well found the behaviour same, i might be missing something 🤔

FWIW fix has been back-ported and merged to 8.15.2 !!

---

<div class="post-metadata">

**Author:** ![DougR](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dougr/32/48095_2.png) [@DougR](https://discuss.elastic.co/u/DougR)\
**Post date:** [September 17, 2024, 1:09pm UTC](https://discuss.elastic.co/t/elastic-lightweight-monitor-host-name-no-longer-using-current-host-name/366421/10 "2024-09-17T13:09:44Z")

</div>

> [@shahzad31](#):
>
> i tested again on 8.14.3 and as well found the behaviour same, i might be missing something 🤔

Maybe I'm wrong about which version I updated from. I may have missed updating the agent to 8.14.3. In any case, it's probably not that relevant in this case, because...

> [@](#):
>
> FWIW fix has been back-ported and merged to 8.15.2 !!

Woot-woot! Thanks! 🥳
