Heartbeat: Populate monitor.name from field value

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

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

Yes, I'm using autodiscover for this.

    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.

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