Custom format of displayed array objects

Hi,
I have a watcher that as an action for met condition sends an email. In the e-mail body I send arrayList object with all those aggregated data that met the condition. Transformation is written in painless.

"actions": {
"send_email": {
"email": {
"to": "********",
"subject": "**********",
"body": "Found too many UI errors in the logs for:\n {{ctx.payload.logs}}"
}
},

Since {{ctx.payload.logs}} returns data in the way that is not friendly to read I would like to do something like toString override. For example I would like to escape curly brackets and each item start from a new line. Any ideas ?

you can use a transform to modify the data. you can also iterate through lists using mustache - very likely you need to do both.

I do use mustache to iterate through, but I don't know how to change the way data is displayed. Can you give me example of a transformation ?

Sorry, forgot to add a link. I was referring to a script transform and you can learn more about it here: https://www.elastic.co/guide/en/elastic-stack-overview/6.3/transform-script.html#transform-script

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