# ELASTIC\_APM\_HOSTNAME not working

**URL:** <https://discuss.elastic.co/t/elastic-apm-hostname-not-working/271915>\
**Category:** APM\
**Tags:** dotnet\
**Created:** [May 2, 2021, 8:03pm UTC](https://discuss.elastic.co/t/elastic-apm-hostname-not-working/271915 "2021-05-02T20:03:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![shlomys](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shlomys/32/127274_2.png) [@shlomys](https://discuss.elastic.co/u/shlomys)\
**Post date:** [May 2, 2021, 8:03pm UTC](https://discuss.elastic.co/t/elastic-apm-hostname-not-working/271915/1 "2021-05-02T20:03:18Z")

</div>

Hi,

I would like to be able to see the hostname in the APM UI so I set it in the environment variables using the folllowing:  
`Environment.SetEnvironmentVariable("ELASTIC_APM_HOSTNAME", "somehostname");`

Still, in the APM UI I only get the default machine hostname which in my cloud environment isn't really usefull.

Just to mention that 'SetEnvironmentVariable' works well for setting 'ELASTIC\_APM\_ENVIRONMENT' and 'ELASTIC\_APM\_SERVER\_URLS'.

Any suggestion what may be wrong?

Thanks.

**Kibana version** :  
7.12  
**Elasticsearch version** :  
7.12  
**APM Server version** :  
7.12  
**APM Agent language and version** :  
dotnet - Elastic.Apm.NetCoreAll 1.9.0

---

<div class="post-metadata">

**Author:** ![forloop](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/forloop/32/9021_2.png) [@forloop](https://discuss.elastic.co/u/forloop)\
**Post date:** [May 4, 2021, 5:37am UTC](https://discuss.elastic.co/t/elastic-apm-hostname-not-working/271915/2 "2021-05-04T05:37:12Z")

</div>

The agent should use the `ELASTIC_APM_HOSTNAME` environment variable value, but it looks like there is a bug in the agent; the property should be sent to APM server as `configured_hostname` rather than `hostname`, as it is currently sent.

I've opened [Add configured hostname by russcam · Pull Request #1290 · elastic/apm-agent-dotnet · GitHub](https://github.com/elastic/apm-agent-dotnet/pull/1290) to address this for the next release.

---

<div class="post-metadata">

**Author:** ![shlomys](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shlomys/32/127274_2.png) [@shlomys](https://discuss.elastic.co/u/shlomys)\
**Post date:** [May 6, 2021, 12:13pm UTC](https://discuss.elastic.co/t/elastic-apm-hostname-not-working/271915/3 "2021-05-06T12:13:50Z")

</div>

Thank you. Any workaround I can do in the meantime?

---

<div class="post-metadata">

**Author:** ![forloop](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/forloop/32/9021_2.png) [@forloop](https://discuss.elastic.co/u/forloop)\
**Post date:** [May 12, 2021, 11:22am UTC](https://discuss.elastic.co/t/elastic-apm-hostname-not-working/271915/4 "2021-05-12T11:22:06Z")

</div>

Unfortunately, there's not a good workaround in the meantime. The new version should be going out soon

---

<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:** [June 2, 2021, 7:22am UTC](https://discuss.elastic.co/t/elastic-apm-hostname-not-working/271915/5 "2021-06-02T07:22:40Z")

</div>

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