# Setting up beat.hostname in Metricbeat

**URL:** <https://discuss.elastic.co/t/setting-up-beat-hostname-in-metricbeat/247442>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [September 3, 2020, 7:11pm UTC](https://discuss.elastic.co/t/setting-up-beat-hostname-in-metricbeat/247442 "2020-09-03T19:11:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![YemaneZewdu](https://avatars.discourse-cdn.com/v4/letter/y/bc8723/32.png) [@YemaneZewdu](https://discuss.elastic.co/u/YemaneZewdu)\
**Post date:** [September 3, 2020, 7:11pm UTC](https://discuss.elastic.co/t/setting-up-beat-hostname-in-metricbeat/247442/1 "2020-09-03T19:11:03Z")

</div>

0

I am super new to these concepts, I apologize if this is a silly thing. I am trying to visualize Metricbeat data on Grafana with Elasticsearch data source, all running locally, but unable to find where "beat.hostname" is added in Metricbeat config.

I have the latest version of both Grafana and Metricbeat and am following this [article](https://fabianlee.org/2017/01/15/grafana-connecting-to-an-elasticsearch-datasource/). In the "Create Dashboard" section, the author mentions that he used "beat.hostname=grafana" as the host name when installing Metricbeat. He then used it on the query editor field to pull out the data on Grafana dashboard.

But where do we set this up? I looked the two YAML files in the Metricbeat folder but there is nothing describing this.

Thanks a lot for your help!

---

<div class="post-metadata">

**Author:** ![willemdh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/willemdh/32/16922_2.png) [@willemdh](https://discuss.elastic.co/u/willemdh)\
**Post date:** [September 3, 2020, 8:18pm UTC](https://discuss.elastic.co/t/setting-up-beat-hostname-in-metricbeat/247442/2 "2020-09-03T20:18:07Z")

</div>

@YemaneZewdu Welcome,

`beat.hostname` is no longer used in recent versions of the Elastic stack. The field has been converted to `agent.name`. But imho you should use `host.name` as host field. Can you find those fields in your data?

---

<div class="post-metadata">

**Author:** ![YemaneZewdu](https://avatars.discourse-cdn.com/v4/letter/y/bc8723/32.png) [@YemaneZewdu](https://discuss.elastic.co/u/YemaneZewdu)\
**Post date:** [September 3, 2020, 8:36pm UTC](https://discuss.elastic.co/t/setting-up-beat-hostname-in-metricbeat/247442/3 "2020-09-03T20:36:13Z")

</div>

Thanks for your reply @willemdh

I didn't find `host.name` in both .yml files. Someone suggested me to look at `name` inside the metricbeat.yml file under `General`. Would it be that?

I used the value in Grafana but didn't get it to work so I was confused if it was the right one.

Thank you

---

<div class="post-metadata">

**Author:** ![willemdh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/willemdh/32/16922_2.png) [@willemdh](https://discuss.elastic.co/u/willemdh)\
**Post date:** [September 3, 2020, 9:05pm UTC](https://discuss.elastic.co/t/setting-up-beat-hostname-in-metricbeat/247442/4 "2020-09-03T21:05:41Z")

</div>

Maybe try add host metadata, check [https://www.elastic.co/guide/en/beats/metricbeat/current/add-host-metadata.html](https://www.elastic.co/guide/en/beats/metricbeat/current/add-host-metadata.html)

---

<div class="post-metadata">

**Author:** ![YemaneZewdu](https://avatars.discourse-cdn.com/v4/letter/y/bc8723/32.png) [@YemaneZewdu](https://discuss.elastic.co/u/YemaneZewdu)\
**Post date:** [September 3, 2020, 9:24pm UTC](https://discuss.elastic.co/t/setting-up-beat-hostname-in-metricbeat/247442/5 "2020-09-03T21:24:50Z")

</div>

Thank you. I'll try that.

---

<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:** [October 1, 2020, 11:24pm UTC](https://discuss.elastic.co/t/setting-up-beat-hostname-in-metricbeat/247442/6 "2020-10-01T23:24:55Z")

</div>

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