# Create custom fields for each host in heartbeat.yml

**URL:** https://discuss.elastic.co/t/create-custom-fields-for-each-host-in-heartbeat-yml/261410
**Category:** Beats
**Tags:** heartbeat
**Created:** [January 18, 2021, 10:44am UTC](https://discuss.elastic.co/t/create-custom-fields-for-each-host-in-heartbeat-yml/261410 "2021-01-18T10:44:03Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![anjana1](https://avatars.discourse-cdn.com/v4/letter/a/22d042/32.png) [@anjana1](https://discuss.elastic.co/u/anjana1)
#### Post date: [January 18, 2021, 10:44am UTC](https://discuss.elastic.co/t/create-custom-fields-for-each-host-in-heartbeat-yml/261410/1 "2021-01-18T10:44:03Z")

</div>

I am trying to combine my heartbeat visualization with APM visualization in same dashboards. Since the field names are not similar, the filter wont work correctly. So I was thinking of creating similar field names and labels per host in heartbeat.  
For eg:- For each host that is monitored add custom fields like labels.region , labels.country etc.

Is it possible to add custom fields for each hosts in heartbeat.yml .

[https://www.elastic.co/guide/en/beats/heartbeat/current/add-fields.html](https://www.elastic.co/guide/en/beats/heartbeat/current/add-fields.html) Can this be used to add custom labels for hosts ?

---

<div class="post-metadata">

### Author: ![Andrew\_Cholakian1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrew_cholakian1/32/3612_2.png) [@Andrew\_Cholakian1](https://discuss.elastic.co/u/Andrew_Cholakian1)
#### Post date: [January 19, 2021, 10:16pm UTC](https://discuss.elastic.co/t/create-custom-fields-for-each-host-in-heartbeat-yml/261410/2 "2021-01-19T22:16:23Z")

</div>

Yes, you can use either the `fields` or `processors` option under each monitor to do this. See our [common monitor options](https://www.elastic.co/guide/en/beats/heartbeat/current/monitor-options.html#monitor-fields) docs.

---

<div class="post-metadata">

### Author: ![anjana1](https://avatars.discourse-cdn.com/v4/letter/a/22d042/32.png) [@anjana1](https://discuss.elastic.co/u/anjana1)
#### Post date: [January 20, 2021, 2:55am UTC](https://discuss.elastic.co/t/create-custom-fields-for-each-host-in-heartbeat-yml/261410/3 "2021-01-20T02:55:09Z")

</div>

Thanks ..Could you pls provide an example of the heartbeat.yml with additional fields configured for each host being monitored .. as I am having trouble putting multiple processors

---

<div class="post-metadata">

### Author: ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)
#### Post date: [January 20, 2021, 3:40am UTC](https://discuss.elastic.co/t/create-custom-fields-for-each-host-in-heartbeat-yml/261410/4 "2021-01-20T03:40:49Z")

</div>

So for each monitor you could do something like this...

```auto
- type: http
  name: spatial-services
  id: spatial-services
  enabled: true
  schedule: '@every 10s'
  ipv4: true
  ipv6: true
  mode: any
  timeout: 16s
  wait: 1s  
  hosts:
    - "www.spatial-services.net"
  fields_under_root : true
  fields:
   labels:
    app_env: Prod
    app_name: "Geocoding Service" 
    app_id: APP001234
    app_tier: 1
    app_resovler_group: geo-services-sre
    app_country: USA
    app_region: AMER

```

---

<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: [February 17, 2021, 5:40am UTC](https://discuss.elastic.co/t/create-custom-fields-for-each-host-in-heartbeat-yml/261410/5 "2021-02-17T05:40:49Z")

</div>

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