<?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: Color in a table based on values in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Color-in-a-table-based-on-values/m-p/89799#M23011</link>
    <description>&lt;P&gt;As I posted above, set the Table's CSS attributes accordingly. You can view a large example here: &lt;A href="http://answers.splunk.com/answers/132524/custom-heatmap-logic-in-advanced-xml"&gt;http://answers.splunk.com/answers/132524/custom-heatmap-logic-in-advanced-xml&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 24 Apr 2014 19:41:27 GMT</pubDate>
    <dc:creator>martin_mueller</dc:creator>
    <dc:date>2014-04-24T19:41:27Z</dc:date>
    <item>
      <title>Color in a table based on values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Color-in-a-table-based-on-values/m-p/89791#M23003</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;

&lt;P&gt;I try to modify text color in a table based on a field value.&lt;/P&gt;

&lt;P&gt;Here's the table i display.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;ScanName              ScanSatus              ScanDate
Scan1                 Up to date             Apr 01, 2013
Scan2                 Up to date             Apr 01, 2013
Scan3                 Up to date             Apr 01, 2013
Scan4                 Not up to date         Mar 01, 2013
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want to put in green the rows where the ScanStatus field is at "Up to date" and red when it's at "Not up to date".&lt;/P&gt;

&lt;P&gt;I'd applied the recommendations on the following topic but i have no result&lt;BR /&gt;
&lt;A href="http://splunk-base.splunk.com/answers/42994/advanced-xml-highlight-certain-values-in-a-table-not-numerical"&gt;http://splunk-base.splunk.com/answers/42994/advanced-xml-highlight-certain-values-in-a-table-not-numerical&lt;/A&gt;&lt;BR /&gt;
The table is still white everywhere, maybe i'm doing something wrong or it dosen't work on 5.0 ?&lt;/P&gt;

&lt;P&gt;Could someone confirm me what is currently the best choice to implement this feature ?&lt;BR /&gt;
Still using .jss/.css files, using the sideview utils, an other solution ?&lt;/P&gt;

&lt;P&gt;Please let me know.&lt;BR /&gt;
Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Apr 2013 11:52:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Color-in-a-table-based-on-values/m-p/89791#M23003</guid>
      <dc:creator>rbw78</dc:creator>
      <dc:date>2013-04-10T11:52:37Z</dc:date>
    </item>
    <item>
      <title>Re: Color in a table based on values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Color-in-a-table-based-on-values/m-p/89792#M23004</link>
      <description>&lt;P&gt;Using a Sideview Utils Table module, you can set rowStyle to &lt;CODE&gt;background-color: $row.fields.color$&lt;/CODE&gt; and let your search results decide the color by themselves, then set hiddenFields to &lt;CODE&gt;color&lt;/CODE&gt; to avoid confusing the viewer.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Apr 2013 12:05:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Color-in-a-table-based-on-values/m-p/89792#M23004</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2013-04-10T12:05:59Z</dc:date>
    </item>
    <item>
      <title>Re: Color in a table based on values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Color-in-a-table-based-on-values/m-p/89793#M23005</link>
      <description>&lt;P&gt;You can do this with application.js (if you dashboards are bundled in a separate app). The nice thing about this approach is that it works in simple XML.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Step one: update application.js&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;First, add the following to $SPLUNK_HOME/etc/apps/YOUR_APP/appserver/static/application.js:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;if( Splunk.Module.SimpleResultsTable ){
    Splunk.Module.SimpleResultsTable = $.klass(Splunk.Module.SimpleResultsTable, {

    renderResults: function($super, htmlFragment) {
        $super(htmlFragment);

        if (this.getInferredEntityName()=="events") {
            this.renderedCount = $("tr", this.container).length - 1;
        }

        $.each( $('.simpleResultsTable td'), function(index, value) {
            $(this).attr('data-value', $(this).text() );
        });
    }
});
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;}&lt;/P&gt;

&lt;P&gt;This code will add the value of the field to the table cell which allows you to write CSS that matches the table such that you can stylize it. Your table cells will look like the following and will contain an attribute named "data-value" which allows you to write CSS selectors to match and stylize table cells:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;td class="d" field="ScanStatus" data-value="Not up to date"&amp;gt;Not up to date
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Step two: define CSS&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Next, make the CSS selectors in $SPLUNK_HOME/etc/apps/YOUR_APP/appserver/static/application.css. Something like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;.SimpleResultsTable tr td.d[field="title"][data-value="Not up to date"]{
    font-weight: bold;
    background-color: #C42323;
    color: white;
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I am using this technique in an application I am writing right now and it works well. See &lt;A href="http://lukemurphey.net/projects/splunk-website-monitoring/wiki"&gt;http://lukemurphey.net/projects/splunk-website-monitoring/wiki&lt;/A&gt; for a screenshot.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Apr 2013 17:28:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Color-in-a-table-based-on-values/m-p/89793#M23005</guid>
      <dc:creator>LukeMurphey</dc:creator>
      <dc:date>2013-04-10T17:28:55Z</dc:date>
    </item>
    <item>
      <title>Re: Color in a table based on values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Color-in-a-table-based-on-values/m-p/89794#M23006</link>
      <description>&lt;P&gt;Thanks for the details Murphey, it works fine now !&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2013 07:46:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Color-in-a-table-based-on-values/m-p/89794#M23006</guid>
      <dc:creator>rbw78</dc:creator>
      <dc:date>2013-04-11T07:46:20Z</dc:date>
    </item>
    <item>
      <title>Re: Color in a table based on values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Color-in-a-table-based-on-values/m-p/89795#M23007</link>
      <description>&lt;P&gt;Neat trick..&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2013 21:28:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Color-in-a-table-based-on-values/m-p/89795#M23007</guid>
      <dc:creator>jonuwz</dc:creator>
      <dc:date>2013-04-11T21:28:34Z</dc:date>
    </item>
    <item>
      <title>Re: Color in a table based on values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Color-in-a-table-based-on-values/m-p/89796#M23008</link>
      <description>&lt;P&gt;This works great.. Question though, any idea how to wildcard the data-value to match multiple values, or any values?&lt;/P&gt;</description>
      <pubDate>Fri, 18 Oct 2013 16:15:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Color-in-a-table-based-on-values/m-p/89796#M23008</guid>
      <dc:creator>ericrobinson</dc:creator>
      <dc:date>2013-10-18T16:15:04Z</dc:date>
    </item>
    <item>
      <title>Re: Color in a table based on values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Color-in-a-table-based-on-values/m-p/89797#M23009</link>
      <description>&lt;P&gt;@ericrobinson: yeah, you use wildcard in CSS. For example, div[class*='foo'] will match foobar, foobarquix, etc..&lt;/P&gt;</description>
      <pubDate>Fri, 18 Oct 2013 18:59:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Color-in-a-table-based-on-values/m-p/89797#M23009</guid>
      <dc:creator>LukeMurphey</dc:creator>
      <dc:date>2013-10-18T18:59:02Z</dc:date>
    </item>
    <item>
      <title>Re: Color in a table based on values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Color-in-a-table-based-on-values/m-p/89798#M23010</link>
      <description>&lt;P&gt;How can we add colors to cells by using sideview utils? I don't want to add any script in application.js. I want to write all the functionality in advanced xml. How can I do this?&lt;/P&gt;</description>
      <pubDate>Thu, 24 Apr 2014 18:49:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Color-in-a-table-based-on-values/m-p/89798#M23010</guid>
      <dc:creator>sampath3033</dc:creator>
      <dc:date>2014-04-24T18:49:42Z</dc:date>
    </item>
    <item>
      <title>Re: Color in a table based on values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Color-in-a-table-based-on-values/m-p/89799#M23011</link>
      <description>&lt;P&gt;As I posted above, set the Table's CSS attributes accordingly. You can view a large example here: &lt;A href="http://answers.splunk.com/answers/132524/custom-heatmap-logic-in-advanced-xml"&gt;http://answers.splunk.com/answers/132524/custom-heatmap-logic-in-advanced-xml&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Apr 2014 19:41:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Color-in-a-table-based-on-values/m-p/89799#M23011</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-04-24T19:41:27Z</dc:date>
    </item>
    <item>
      <title>Re: Color in a table based on values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Color-in-a-table-based-on-values/m-p/89800#M23012</link>
      <description>&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Wed, 05 Nov 2014 13:53:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Color-in-a-table-based-on-values/m-p/89800#M23012</guid>
      <dc:creator>sampath3033</dc:creator>
      <dc:date>2014-11-05T13:53:03Z</dc:date>
    </item>
    <item>
      <title>Re: Color in a table based on values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Color-in-a-table-based-on-values/m-p/89801#M23013</link>
      <description>&lt;P&gt;below are my scipt, css, xml file i am not able to load the color in rows.&lt;BR /&gt;
Please help me in this...&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;testing.css&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;.SimpleResultsTable tr td.d[field="log_subtype"][data-value="virus"]{
     font-weight: bold;
     background-color: #C42323;
         color: white;
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;testing.js&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;if( Splunk.Module.SimpleResultsTable ){
    Splunk.Module.SimpleResultsTable = $.klass(Splunk.Module.SimpleResultsTable, {

    renderResults: function($super, htmlFragment) {
         $super(htmlFragment);

          if (this.getInferredEntityName()=="testing") {
              this.renderedCount = $("tr", this.container).length - 1;
         }

     $.each( $('.simpleResultsTable td'), function(index, value) {
             $(this).attr('data-value', $(this).text() );
         });
     }
 });
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;xml:&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;dashboard script="testing.js" stylesheet="testing.css"&amp;gt;
  &amp;lt;label&amp;gt;testing&amp;lt;/label&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;table id="testing"&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;source="/tmp/tests.csv" host="10.0.255.247" sourcetype="csv"| fillnull value=NULL | table log_subtype,device_id,eventSignature&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;&amp;lt;/latest&amp;gt;
        &amp;lt;/search&amp;gt;
      &amp;lt;/table&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/dashboard&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 20 Feb 2015 10:30:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Color-in-a-table-based-on-values/m-p/89801#M23013</guid>
      <dc:creator>splunker12er</dc:creator>
      <dc:date>2015-02-20T10:30:45Z</dc:date>
    </item>
    <item>
      <title>Re: Color in a table based on values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Color-in-a-table-based-on-values/m-p/89802#M23014</link>
      <description>&lt;P&gt;I have the same problem.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Feb 2015 17:00:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Color-in-a-table-based-on-values/m-p/89802#M23014</guid>
      <dc:creator>rajendra_b</dc:creator>
      <dc:date>2015-02-20T17:00:22Z</dc:date>
    </item>
    <item>
      <title>Re: Color in a table based on values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Color-in-a-table-based-on-values/m-p/89803#M23015</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;Thank you. your approach is very simple and easy to understand.  Although I am facing some trouble here. &lt;/P&gt;

&lt;P&gt;I too want to achieve same result as you defined here. I followed below steps.&lt;/P&gt;

&lt;P&gt;1- created an App.&lt;BR /&gt;
2- Updated the .js and .css files in /appserver/static/ folder for my app.&lt;/P&gt;

&lt;P&gt;Still I am not able to get the result. I have provided the search  &amp;amp; code if you would be kind to look.&lt;/P&gt;

&lt;P&gt;search:&lt;BR /&gt;
host=XXXXX | eval state=case(Event_code=0,"passed",Event_code!=0,"failed") | table host _time state&lt;/P&gt;

&lt;P&gt;Still the table cell is white , there is no color, I don't know what I am missing. Can you please tell me? I need to submit my work and I am hitting deal lock every time.&lt;/P&gt;

&lt;P&gt;Thank you for you time.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 06:45:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Color-in-a-table-based-on-values/m-p/89803#M23015</guid>
      <dc:creator>ambujhbti</dc:creator>
      <dc:date>2020-09-29T06:45:22Z</dc:date>
    </item>
    <item>
      <title>Re: Color in a table based on values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Color-in-a-table-based-on-values/m-p/89804#M23016</link>
      <description>&lt;P&gt;What version of Splunk are you using?&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jul 2015 18:37:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Color-in-a-table-based-on-values/m-p/89804#M23016</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2015-07-21T18:37:40Z</dc:date>
    </item>
    <item>
      <title>Re: Color in a table based on values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Color-in-a-table-based-on-values/m-p/89805#M23017</link>
      <description>&lt;P&gt;Version: 6.2&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jul 2015 18:41:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Color-in-a-table-based-on-values/m-p/89805#M23017</guid>
      <dc:creator>ambujhbti</dc:creator>
      <dc:date>2015-07-21T18:41:17Z</dc:date>
    </item>
    <item>
      <title>Re: Color in a table based on values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Color-in-a-table-based-on-values/m-p/89806#M23018</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;Version is 6.2&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jul 2015 18:43:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Color-in-a-table-based-on-values/m-p/89806#M23018</guid>
      <dc:creator>ambujhbti</dc:creator>
      <dc:date>2015-07-21T18:43:15Z</dc:date>
    </item>
    <item>
      <title>Re: Color in a table based on values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Color-in-a-table-based-on-values/m-p/89807#M23019</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;One doubt:&lt;/P&gt;

&lt;P&gt;in this line of code:&lt;/P&gt;

&lt;P&gt;td class="d" field="ScanStatus" data-value="Not up to date"&amp;gt;Not up to date&lt;/P&gt;

&lt;P&gt;do you mean to say that I can see code like this when I open XML source code of my dashboard?  As I didn't find any. It might be possible that I missed this step somewhere? just wanted to let you know. &lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jul 2015 18:45:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Color-in-a-table-based-on-values/m-p/89807#M23019</guid>
      <dc:creator>ambujhbti</dc:creator>
      <dc:date>2015-07-21T18:45:47Z</dc:date>
    </item>
  </channel>
</rss>

