How to get variable values in triggered alert in AWS ElasticSearch Service?
The trigger syntax uses Moustache templates (man page), which is not comprehensive. The trick is to loop through the results and refer to variables like this:
- Total hits: {{#ctx.results}}{{#hits}}{{total}}{{/hits}}{{/ctx.results}}- Period start: {{ctx.periodStart}}- Period end: {{ctx.periodEnd}}- HTTP errors: {{#ctx.results}} {{#hits}} {{#hits}} {{#_source}} ip:{{ip}} status: {{status}} : {{error.message}} at path: {{path}} {{/_source}} {{/hits}} {{/hits}} {{/ctx.results}}