Inconsistent newlines in watcher email body text

alerting

(Jamie Burks) #1

I'm using this Watcher code to send myself emails:

    "body": {
      "text": "{{#ctx.payload.hits.hits}}{{_source.@timestamp}} {{_source.message}}\n{{/ctx.payload.hits.hits}}"

But I don't get a newline in the email body between hits. But when I add some extra characters around the newline like this:

    "body": {
      "text": "{{#ctx.payload.hits.hits}}{{_source.@timestamp}} {{_source.message}} *\n* {{/ctx.payload.hits.hits}}"

The newline magically appears between the asterisks. This is the latest ELK stack with Kibana 6.4.

Why is this inconsistent? I just want a simple list of my hits in the email body.

Thanks


(Guillaume Dufrenne) #2

You can change the body to html :slight_smile:
"body": { "html": """ <html>...</html>"""}

Then you will be able to customize emails as much as you want


(Alexander Reelsen) #3

this looks like a duplicate from Inconsistent newlines in email body text - unless I am missing something.


(system) #4

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