# Heartbeat: Populate monitor.name from field value

**URL:** https://discuss.elastic.co/t/heartbeat-populate-monitor-name-from-field-value/299010
**Category:** Beats
**Tags:** heartbeat
**Created:** [March 7, 2022, 7:54pm UTC](https://discuss.elastic.co/t/heartbeat-populate-monitor-name-from-field-value/299010 "2022-03-07T19:54:06Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Jeff\_Morton](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jeff_morton/32/62380_2.png) [@Jeff\_Morton](https://discuss.elastic.co/u/Jeff_Morton)
#### Post date: [March 7, 2022, 7:54pm UTC](https://discuss.elastic.co/t/heartbeat-populate-monitor-name-from-field-value/299010/1 "2022-03-07T19:54:06Z")

</div>

Greetings,

I'm trying to dynamically populate the heartbeat monitor name (monitor.name field) dynamically from a predefined kubernetes label.

I've attempted using the copy\_field processor, but this doesn't appear to work.

Does anyone have any suggestions for dynamically populating this field?

Regards

---

<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: [March 7, 2022, 9:16pm UTC](https://discuss.elastic.co/t/heartbeat-populate-monitor-name-from-field-value/299010/2 "2022-03-07T21:16:44Z")

</div>

Can you share your heartbeat config? Are you using k8s autodiscover?

---

<div class="post-metadata">

### Author: ![Jeff\_Morton](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jeff_morton/32/62380_2.png) [@Jeff\_Morton](https://discuss.elastic.co/u/Jeff_Morton)
#### Post date: [March 8, 2022, 2:26pm UTC](https://discuss.elastic.co/t/heartbeat-populate-monitor-name-from-field-value/299010/3 "2022-03-08T14:26:31Z")

</div>

Yes, I'm using autodiscover for this.

```auto
    heartbeat.autodiscover:
      providers:
        - type: kubernetes
          resource: service
          scope: cluster
          templates:
            - condition:
                contains:
                  kubernetes.service.name: something
              config:
                - type: http
                  hosts: ["${data.host}:${data.port}/ping"]
                  schedule: "@every 1m"
                  timeout: 1s
    processors:
      - copy_fields:
          fields:
            - from: kubernetes.labels.something/name
              to: monitor.name
          fail_on_error: false
          ignore_missing: true
      - copy_fields:
          fields:
            - from: kubernetes.labels.something/name
              to: service.name
          fail_on_error: false
          ignore_missing: true

```

The result of this is that service.name is populated correctly, but monitor.name is empty.

---

<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: [April 5, 2022, 4:27pm UTC](https://discuss.elastic.co/t/heartbeat-populate-monitor-name-from-field-value/299010/4 "2022-04-05T16:27:26Z")

</div>

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