How to use new line '\n' in a loop

I have a watch which triggers a alert on following condition " Multiple Virus Detected Alert in last one hour" for simulation i have changed it to 10 sec.

Problem: when i print following
"text": "There are {{#ctx.payload.aggregations.host_bucket.buckets}}{{doc_count}} {{key}} {{/ctx.payload.aggregations.host_bucket.buckets}}"

How to use new line '\n' in a loop ... what would be the correct syntax.
below is the result right now:

"subject": " Malwarebytes- Multiple Virus Detected Alert in last one hour test 2 ",
"body": {
"text": "There are 4401793 MNL12PJ7C2-W7D 135973 VDILUBAPA01-WXV 28043 ALABARBCA01WXL 13476 ALAANDERSC2-W7L 394 RISOKCL-3026927 384 ALALILJMA01-W7L 330 ALAPOOLCH01-W7L 125 DAYWILMOTKXW10 52 ALADAWSJA03-WXL 48 RDP-4164411-W7 40 BWDPATENI03-W7L 40 OKCBIKOBO01WXL 38 BCTLWXMALOCA01 24 BCTLW7SUMKINTE 20 DUBBREEJO01-W0L 19 DAYMCKEONJX-W7D 17 MNL11PQ7C2-W10D 14 BWDKOREIBNA-W7L 12 ALAEUVS001-W7D 11 BCTDALESICM-WXL 9 ALALINGARSX-W7L 8 ILOCD6X132-WXD 8 ILOGG6X132-WXD 8 MNL11D70N2-W10L 7 ILO4D6C862-WXD 6 RDPWOODDA01-WXL 5 ALAPARASR01-W7L 5 BCTLW7SANTMA01A 5 MINLW10-FN2G71 4 ALACHENWX-W7L 4 ALAINJAVI01WRL 4 ALALOANER1-WXL 4 ALAMERRRO01-WXL 4 ALAPFEIFFALWXL 4 ALASTRAK01-WXL 4 ALAWALKERKM-WXL 4 BCTCANNHU01-WXL 4 BCTHILLKY01-WXL 4 BRAMORARE01WXL 4 BWDSOLLSC-W10D 4 DULCHANKE01WXD 4 HBECOOMERKS-WXL 4 OKCBURFMA01-WXL 4 OKCHAUSDA01-WXL 4 TLVHERZEL01W7L 4 VDIBASAKSX-WXV 4 VDIJAYCMA01-WXV 4 VDIKUMAGU01-WXV 4 VDILAKSBH01-WXV 4 VDIMOHAMMRX-WXV 4 VDIVELUNA01-WXV 3 ALAJONESJD-W7D 3 OKCBRADNO01WXL 2 ALAVW10-SA214 2 BCTLW7JAINHX 2 BWDMATHENKD-10L 2 ILO396C862-WXD 2 ILO8M39T92-W7D 2 MNL12BK7C2-W7D 1 ALACLARYCW-W7L 1 ALAFLOJA01WXL 1 ALAMECHSA01-W7L 1 ALANAIKSI01-W7L 1 ALAPALURA01-W7D 1 BCTORDEES01-WXL 1 BZNDOLESHBR-WXL 1 CARHAINOL01-W10 1 EMALUNDGE01-WXL 1 ILO3H6X132-W7D 1 OKCVALEMA01-W7D "
}

Just simply add \n anywhere, such as:

"text": "They are:\n {{#ctx.payload.aggregations.host_bucket.buckets}}{{doc_count}} {{key}} \n{{/ctx.payload.aggregations.host_bucket.buckets}}"
1 Like

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