You have quite a number of issue to overcome when tackling this and your first step is to understand the boundaries between products and where to look to fix something.
When UIM sends an email it essentially takes the individual variables ($message, $custom_5, etc) and substitutes them into the text or html template you have specified. It then puts that into the "message" section of a standard email.
Your substitutions appear to be working - they might not have the data you need but they are operating. That means that really this isn't a UIM issue that you are tackling here - it's either a mail formatting issue or an issue with the way your email client decides to display the message content.
I'd suggest having a look at the HTML source of the email message that's displayed in your email client and then ask yourself the question why, if it were just hand written HTML, why it's not rendering as you desire.
And if you want/need to parse apart pieces of individual variables - like putting carriage returns in the message, you should just go the Lua route - ultimately you will have the most flexibility that way - likely too, in order to get the formatting to work you will need to introduce an HTML header into the message and to do that you'll need to go the Lua route anyway.
Original Message:
Sent: 08-19-2020 06:47 AM
From: Oswaldo Muñoz Matos
Subject: Email Notification Message Body
Hi,
Using $message = $var1.."\n"..$var2.."\n".. doesn´t work.
If i put the string:
PRUEBA <tr><td>Problema:699 -> URL: https://gac64053.live.dynatrace.com/#problems/problemdetails;pid=-2050460672328873699_1596800040000V2;gf=all </td></tr> <tr><td>Problema:692 -> URL: https://gac64053.live.dynatrace.com/#problems/problemdetails;pid=-8885770074766166692_1596716880000V2;gf=all </td></tr> <tr><td>Problema:126 -> URL: https://gac64053.live.dynatrace.com/#problems/problemdetails;pid=-4945342424548746126_1595314380000V2;gf=all </td></tr>
In the $message variable the emailgtw replace the HTML tags and doesn´t work too, but if the string above i put it in the $custom_5(for example) and add this variable in the HTML template in emailgtw it WORKS!!!
I have used the following script in a pre-procesing rule:
...
event.custom_5 = "Text with HTML tags"
return event
In the HTML template in emailgtw:
...
<tr>
<td width="100%" bgcolor="#FFFFFF"><i>$message</i></td>
</tr>
<tr>
<td width="100%" bgcolor="#FFFFFF"><i>$custom_5</i></td>
</tr>
...
Original Message:
Sent: 08-18-2020 08:48 AM
From: Gene HOWARD
Subject: Email Notification Message Body
That is what I would expect as the field is treated as a string field.
The only thing I think might work would be adding in none printing characters to the field.
So you would need to break up the alarm message into variables and add them back togeather with hard returns.
such as $message = $var1.."\n"..$var2.."\n"..
https://www.lua.org/pil/2.4.html
Here is an example of how to parse a message
https://community.broadcom.com/enterprisesoftware/viewdocument/tech-tip-uim-lua-script-to-split-a?CommunityKey=170eb4e5-a593-4af2-ad1d-f7655e31513b&tab=librarydocuments
------------------------------
Gene Howard
Principal Support Engineer
Broadcom
Original Message:
Sent: 08-18-2020 08:28 AM
From: Oswaldo Muñoz Matos
Subject: Email Notification Message Body
HI,
What i want is to format the alarm message. I am using the NAS LUA pre-processing to add some aditional information in the message and an AO profile to send the email.
I am using HTML tags but don´t work. The email is as follow:
Original Message:
Sent: 08-18-2020 07:59 AM
From: Marius Nitu
Subject: Email Notification Message Body
My guess is that you can format the cdm Message definition using HTML tags. Doing so will make the Email look good, but it will screw the alarms in the Alarm Dashboard.
Original Message:
Sent: 08-18-2020 03:08 AM
From: Oswaldo Muñoz Matos
Subject: Email Notification Message Body
Hi Christopher,
¿were you able to format the message variable? I want to do the same but i can't
Thanks
Original Message:
Sent: 04-13-2017 03:51 PM
From: Christopher Duryea
Subject: Email Notification Message Body
I have an email notification and it contains the following section (obtained from the $message variable) within the email body:
Average (5 samples) total cpu is now 31.45%, which is above the error threshold (30%).Top Processes [splunkd.exe[764]-(27.08%)];[java.exe[4176]-(0.58%)];[os_agent.exe[2264]-(0.50%)];[DsaServer.exe[1716]-(0.33%)];[java.exe[2012]-(0.25%)]
I would like to format it as follows so that it is easier on the eyes to read and read quickly:
Average (5 samples) total cpu is now 31.45%, which is above the error threshold (30%).
Top Processes
[splunkd.exe[764]-(27.08%)]
[java.exe[4176]-(0.58%)]
[os_agent.exe[2264]-(0.50%)]
[DsaServer.exe[1716]-(0.33%)]
[java.exe[2012]-(0.25%)]
Can someone point me in the right direction to accomplish this?