Access heartbeat fields on rule action

I have a heartbeat monitor with custom fields and fields_under_root: true
How can I access these custom fields in a rule action?

For example, I have the below monitor:

- type: http
  id: dummy-nonexistent-url3
  name: Dummy nonexistent url3
  enabled: true
  schedule: '@every 10s'
  urls: 
    - https://www.notrealurl6663.com
  ipv4: true
  ipv6: true
  mode: any
  fields:
    iAmACustomField: hello
  tags: [monitoring, dev]

And an uptime rule with below webhook connector body:

{
    "@timestamp": "{{date}}",
    "message": "{{state.latestErrorMessage}}",
    "alert.id": "{{alert.id}}",
    "alert.actionGroupName": "{{alert.actionGroupName}}",
    "alert.actionGroup": "{{alert.actionGroup}}",
    "state.monitorId": "{{state.monitorId}}",
    "state.monitorName": "{{state.monitorName}}",
    "rule.id": "{{rule.id}}",
    "rule.name": "{{rule.name}}",
    "rule.type": "{{rule.type}}",
    "rule.tags": "{{rule.tags}}",
    "state.isTriggered": "{{state.isTriggered}}",
    "state.monitorUrl": "{{state.monitorUrl}}",
    "state.monitorType": "{{state.monitorType}}",
    "state.currentTriggerStarted": "{{state.currentTriggerStarted}}",
    "state.firstCheckedAt": "{{state.firstCheckedAt}}",
    "state.lastCheckedAt": "{{state.lastCheckedAt}}",
    "state.firstTriggeredAt": "{{state.firstTriggeredAt}}",
    "state.lastTriggeredAt": "{{state.lastTriggeredAt}}",
    "state.lastResolvedAt": "{{state.lastResolvedAt}}",
    "state.observerHostname": "{{state.observerHostname}}",
    "state.statusMessage": "{{state.statusMessage}}",
    "iamacustomfield": "{{status.fields.iAmACustomField}}"
}

The webhook connector is logging these alert events to a data stream index and documents are created with all other specified values except for "iamacustomfield" which comes up empty.

I am using heartbeat v7.16.1

Unfortunately we don't support custom fields at the moment for alerting. Would you mind opening a github issue on kibana if it's a feature you'd like to see? If you could put a link to it here that'd be appreciated!

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