<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Updating text color based on condition using sendemail.py in Alerting</title>
    <link>https://community.splunk.com/t5/Alerting/Updating-text-color-based-on-condition-using-sendemail-py/m-p/684746#M15922</link>
    <description>&lt;P&gt;You recognize that this is a Splunk forum where volunteers offer help related to Splunk, right? &amp;nbsp;As I said, Splunk does not "color" search results. (The only coloring function in Splunk is provided in dashboard visualization.) &amp;nbsp;If you want to color text, you will need to develop something external to Splunk. &amp;nbsp;As you suggested, you can possibly achieve this by modifying sendmail.py (not recommended). &amp;nbsp;Alternatively, you can develop a custom command for this. &amp;nbsp;Either way, this is not the right forum.&lt;/P&gt;</description>
    <pubDate>Fri, 19 Apr 2024 06:17:47 GMT</pubDate>
    <dc:creator>yuanliu</dc:creator>
    <dc:date>2024-04-19T06:17:47Z</dc:date>
    <item>
      <title>Updating text color based on condition using sendemail.py</title>
      <link>https://community.splunk.com/t5/Alerting/Updating-text-color-based-on-condition-using-sendemail-py/m-p/684524#M15916</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I've below dataset from Splunk search.&lt;/P&gt;&lt;TABLE width="143"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="59"&gt;Name&lt;/TD&gt;&lt;TD width="84"&gt;percentage&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;71%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;90%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;TD&gt;44%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;D&lt;/TD&gt;&lt;TD&gt;88%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;E&lt;/TD&gt;&lt;TD&gt;78%&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;All I need to change the percentage field values color as per below rule in the email alert. My requirement to achieve this by updating the sendemail.py.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;95+ green, 80-94 amber, &amp;lt;80 = red&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/49493"&gt;@tscroggins&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/33901"&gt;@yuanliu&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/6367"&gt;@bowesmana&lt;/a&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Apr 2024 15:31:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Updating-text-color-based-on-condition-using-sendemail-py/m-p/684524#M15916</guid>
      <dc:creator>mnj1809</dc:creator>
      <dc:date>2024-04-17T15:31:08Z</dc:date>
    </item>
    <item>
      <title>Re: Updating text color based on condition using sendemail.py</title>
      <link>https://community.splunk.com/t5/Alerting/Updating-text-color-based-on-condition-using-sendemail-py/m-p/684578#M15919</link>
      <description>&lt;P&gt;Let me clarify: When you say "color", you are talking about converting percentage text to a string representation of color code, not to color the percentage text in E-mail alert. &amp;nbsp;Correct? &amp;nbsp;In other words, you want something like&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Name&lt;/TD&gt;&lt;TD&gt;color&lt;/TD&gt;&lt;TD&gt;percentage&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;red&lt;/TD&gt;&lt;TD&gt;71&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;amber&lt;/TD&gt;&lt;TD&gt;90&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;TD&gt;red&lt;/TD&gt;&lt;TD&gt;44&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;D&lt;/TD&gt;&lt;TD&gt;amber&lt;/TD&gt;&lt;TD&gt;88&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;E&lt;/TD&gt;&lt;TD&gt;red&lt;/TD&gt;&lt;TD&gt;78&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Because while potentially doable (and likely will involve a custom command you need to develop externally), Splunk doesn't provide such a function to color text used in E-mail alerts. &amp;nbsp;If this is the correct requirement, look up documentation for&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/ConditionalFunctions#case.28.26lt.3Bcondition.26gt.3B.2C.26lt.3Bvalue.26gt.3B.2C....29" target="_blank" rel="noopener"&gt;case&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I further assume that your "percentage" field doesn't come with a percent sign (&lt;FONT face="courier new,courier"&gt;%&lt;/FONT&gt;); if you want that % in E-mail, you can always add it after color mapping.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval color = case(percentage &amp;lt; 80, "red", percentage &amp;lt; 95, "amber", true(), "green")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a data emulation you can play with and compare with real data&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults format=csv data="Name,	percentage
A,	71%
B,	90%
C,	44%
D,	88%
E,	78%"
| eval percentage = replace(percentage, "%", "")
``` data emulation above ```&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Apr 2024 22:40:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Updating-text-color-based-on-condition-using-sendemail-py/m-p/684578#M15919</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2024-04-17T22:40:01Z</dc:date>
    </item>
    <item>
      <title>Re: Updating text color based on condition using sendemail.py</title>
      <link>https://community.splunk.com/t5/Alerting/Updating-text-color-based-on-condition-using-sendemail-py/m-p/684603#M15921</link>
      <description>&lt;P&gt;Thanks Y&lt;SPAN&gt;uanliu for your quick reply.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Yes, I need % sign included. In the email body I need to color the data of percentage column like below:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mnj1809_0-1713419590140.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/30463i4AF6F060F9D60AC5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mnj1809_0-1713419590140.png" alt="mnj1809_0-1713419590140.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/33901"&gt;@yuanliu&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Apr 2024 05:58:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Updating-text-color-based-on-condition-using-sendemail-py/m-p/684603#M15921</guid>
      <dc:creator>mnj1809</dc:creator>
      <dc:date>2024-04-18T05:58:22Z</dc:date>
    </item>
    <item>
      <title>Re: Updating text color based on condition using sendemail.py</title>
      <link>https://community.splunk.com/t5/Alerting/Updating-text-color-based-on-condition-using-sendemail-py/m-p/684746#M15922</link>
      <description>&lt;P&gt;You recognize that this is a Splunk forum where volunteers offer help related to Splunk, right? &amp;nbsp;As I said, Splunk does not "color" search results. (The only coloring function in Splunk is provided in dashboard visualization.) &amp;nbsp;If you want to color text, you will need to develop something external to Splunk. &amp;nbsp;As you suggested, you can possibly achieve this by modifying sendmail.py (not recommended). &amp;nbsp;Alternatively, you can develop a custom command for this. &amp;nbsp;Either way, this is not the right forum.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Apr 2024 06:17:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Updating-text-color-based-on-condition-using-sendemail-py/m-p/684746#M15922</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2024-04-19T06:17:47Z</dc:date>
    </item>
    <item>
      <title>Re: Updating text color based on condition using sendemail.py</title>
      <link>https://community.splunk.com/t5/Alerting/Updating-text-color-based-on-condition-using-sendemail-py/m-p/685640#M15959</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/33901"&gt;@yuanliu&lt;/a&gt;&amp;nbsp;for your quick response.&lt;BR /&gt;&lt;BR /&gt;I am totally unaware how to achieve this by creating a custom command.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Apr 2024 15:10:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Updating-text-color-based-on-condition-using-sendemail-py/m-p/685640#M15959</guid>
      <dc:creator>mnj1809</dc:creator>
      <dc:date>2024-04-26T15:10:25Z</dc:date>
    </item>
    <item>
      <title>Re: Updating text color based on condition using sendemail.py</title>
      <link>https://community.splunk.com/t5/Alerting/Updating-text-color-based-on-condition-using-sendemail-py/m-p/685721#M15969</link>
      <description>&lt;P&gt;Start with this doc:&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Search/GetstartedwithSearch#collapseDesktop18" target="_blank" rel="noopener"&gt;Write Custom Search Commands&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Sun, 28 Apr 2024 00:35:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Updating-text-color-based-on-condition-using-sendemail-py/m-p/685721#M15969</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2024-04-28T00:35:22Z</dc:date>
    </item>
    <item>
      <title>Re: Updating text color based on condition using sendemail.py</title>
      <link>https://community.splunk.com/t5/Alerting/Updating-text-color-based-on-condition-using-sendemail-py/m-p/685725#M15970</link>
      <description>&lt;P&gt;I'd simply say don't go down this path.&lt;/P&gt;&lt;P&gt;sendemail.py is quite well written but a bit confusing for a non-experienced pythoneer. So you'll put a lot of effort for just one use-case. Additionally you'll get stuck with something you'll have to maintain yourself (what if there are updates to the main sendemail.py? What if there are security fixes? Will you backport those?).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 28 Apr 2024 07:14:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Updating-text-color-based-on-condition-using-sendemail-py/m-p/685725#M15970</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2024-04-28T07:14:12Z</dc:date>
    </item>
  </channel>
</rss>

