Graylog Notification Email Template Foreach New Lines

Read through documentation, JMTE docs and ran a few searches - can’t seem to find an answer.

The standard template runs the following foreach to iterate through log entries:
${if backlog}${foreach backlog message}${message}${end}${else}<None>${end}
However, this will dump each log entry directly after the last (log1log2log3log4), I’d like to drop each one on a new line.

I read that I should be able to do something like ${foreach backlog message \r\n}. That doesn’t work (removes the \'s). So I tried ${foreach backlog message \\r\\n}. That just drops \r\n at the end of each log entry. Can anyone give me a way to import new lines into my template?

Additionally, it would be super handy if the “test” notification generated 3 dummy log entries to fully test the alerting without manually tripping events.

Thanks for any help.

Have you tried just putting a new line in the template?

E.g.

${if backlog} ${foreach backlog message}
${message}

${end}${else}<None>${end}

Email client /may/ remove additional lines so, you might have to tell it not to.

${if backlog} ${foreach backlog message}
${message}
${end}${else}<None>${end} 

Will add a space after all log entries.

----
Log:
Log1Log2

----
${if backlog}
${foreach backlog message}
${message}${end}${else}<None>${end} 

Will add a space before the first log entry.

----
Log:

Log1Log2
----
${if backlog} ${foreach backlog message}

${message}${end}${else}<None>${end} 

Will force a newline between each entry. I will probably keep this setting for now, although my preference would be not to have the dead space and instead just have each line terminate properly.

----
Log:

Log1

Log2

----

Unable to create:

----
Log:
Log1
Log2
----

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