Opensearch alerting trigger custom message

Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):3.0.0

Describe the issue:I need to set up an alert and trigger and trigger message should contain some custom fields in the messege

currently set up per query monitor with visual editor and in custom messege field in notification

Host: {{_source.host}}
Host IP: {{_source.hostip}}

but the notification messege doesn’t contains any values, how can we fix it

Configuration:

Relevant Logs or Screenshots:

@sandeepm257 Try the below instead

Host: {{ctx.results.0.hits.hits.0._source.host}}
Host IP: {{ctx.results.0.hits.hits.0._source.hostip}}

Hi Pablo

Thanks for reply, still we are getting some syntax error

@sandeepm257 I’m getting the same error in 3.0.0. It looks like a bug when running a test message in OpenSearch Dashboards UI.
When you enable the monitor, you’ll see messages with the valid values in your email notification.

I’ve tested against 3.4.0, and the test message has no errors with the same custom message.

Thanks pablo

The below messege is working fine in extraction query editor mode but not in visual editor

{{#ctx.results.0.hits.hits}}
  {{_source.host}}
  {{_source.hostip}}
{{/ctx.results.0.hits.hits}}

Thanks we can close this issue
1 Like