Elastic ML Alert Mustache Syntax (Break Line)

Hi,

I would like to adjust my email alert to break to a new line.

From above image, the upper context for (Environment Affected) is working as I used {{{foo}}} to break it.

However, it does not work for the (Detector Attribute) context.

It became weirdly manner the message.

How do I fix this? How do I break it to a new line the alert message?

Below is my mustache syntax code for the email message:

- Environment Affected:
{{#context.topInfluencers.length}}
    {{#context.topInfluencers}}
     {{{foo}}} 
     {{influencer_field_name}} = {{influencer_field_value}} 
     {{/context.topInfluencers}}
{{/context.topInfluencers.length}}

- Detector Attribute:
{{#context.topRecords.length}}
   {{#context.topRecords}}
         {{{foo}}} 
         {{function}}({{field_name}}) {{by_field_value}}{{over_field_value}}
         {{partition_field_value}}, 
         Typical Value of Detector: [{{typical}}], Actual Value of Detector
         (Anomaly): [{{actual}}] 
     {{/context.topRecords}}
{{/context.topRecords.length}}

- Anomaly score: {{context.score}}

Thank you.

Hi @aisyaharifin,

The reason for broken formatting is the escaping for special characters contained in the field_name variable and the others. You can disable it by wrapping a variable with an extra set of curly braces, i.e. {{{field_name}}} instead of {{field_name}}.

Hope it helps.

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