<?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: How do I use the singleValue module to color code search results? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-use-the-SingleValue-module-to-color-code-search-results/m-p/9041#M2</link>
    <description>&lt;P&gt;To Rakesh: it's a little unclear what your desired output is.  The search you specify will output a table with 2 values: a 'count' and then an enumeration.  Are you trying to display 2 different images, or just a colored box?  Do you want to see the actual count?&lt;/P&gt;</description>
    <pubDate>Wed, 04 Nov 2009 04:08:22 GMT</pubDate>
    <dc:creator>Johnvey</dc:creator>
    <dc:date>2009-11-04T04:08:22Z</dc:date>
    <item>
      <title>How do I use the SingleValue module to color code search results?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-use-the-SingleValue-module-to-color-code-search-results/m-p/9040#M1</link>
      <description>&lt;P&gt;In discussions, Johnvey has suggested to use the SingleValue module to display the output of the results.&lt;/P&gt;
&lt;P&gt;In fact, with the rangemap search keyword, we are simply getting the output in the form of text and there is still no way for us to interpret it and display it in another format (like an image).&lt;/P&gt;
&lt;P&gt;Please see the code snippet below:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;&amp;lt;view refresh="60" template="dashboard.html"&amp;gt;
   &amp;lt;module name="HiddenSearch" layoutPanel="panel_row1_col1"
 group="FuturesDemo Messages per minute" autoRun="True"&amp;gt;
      &amp;lt;param name="search"&amp;gt;index="os" foo
FuturesDemo earliest="-1m" |stats count|rangemap field=count red=0-0
default=green&amp;lt;/param&amp;gt;
      &amp;lt;param name="earliest"&amp;gt;-1m&amp;lt;/param&amp;gt;
      &amp;lt;module name="ResultsHeader"&amp;gt;
         &amp;lt;param name="entityName"&amp;gt;scanned&amp;lt;/param&amp;gt;
         &amp;lt;param name="entityLabel"&amp;gt;foo events&amp;lt;/param&amp;gt;
             &amp;lt;module name="FlashChart"&amp;gt;
               &amp;lt;param name="height"&amp;gt;180px&amp;lt;/param&amp;gt;
               &amp;lt;param name="width"&amp;gt;80%&amp;lt;/param&amp;gt;
             &amp;lt;/module&amp;gt;
      &amp;lt;/module&amp;gt;
  &amp;lt;/module&amp;gt;
&amp;lt;/view&amp;gt;&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jan 2021 19:39:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-use-the-SingleValue-module-to-color-code-search-results/m-p/9040#M1</guid>
      <dc:creator>tpaulsen</dc:creator>
      <dc:date>2021-01-11T19:39:53Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use the singleValue module to color code search results?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-use-the-SingleValue-module-to-color-code-search-results/m-p/9041#M2</link>
      <description>&lt;P&gt;To Rakesh: it's a little unclear what your desired output is.  The search you specify will output a table with 2 values: a 'count' and then an enumeration.  Are you trying to display 2 different images, or just a colored box?  Do you want to see the actual count?&lt;/P&gt;</description>
      <pubDate>Wed, 04 Nov 2009 04:08:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-use-the-SingleValue-module-to-color-code-search-results/m-p/9041#M2</guid>
      <dc:creator>Johnvey</dc:creator>
      <dc:date>2009-11-04T04:08:22Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use the singleValue module to color code search results?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-use-the-SingleValue-module-to-color-code-search-results/m-p/9042#M3</link>
      <description>&lt;P&gt;So to clarify your question:&lt;/P&gt;

&lt;P&gt;The current configuration will display the text that you desire.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;view refresh="60" template="dashboard.html"&amp;gt;
   &amp;lt;module name="HiddenSearch" layoutPanel="panel_row1_col1" autoRun="True"&amp;gt;
      &amp;lt;param name="search"&amp;gt;index="os" foo earliest="-1m" |stats count|rangemap field=count red=0-0 default=green&amp;lt;/param&amp;gt;
       &amp;lt;module name="SingleValue"&amp;gt; 
          &amp;lt;param name="labelPosition"&amp;gt;before&amp;lt;/param&amp;gt; 
          &amp;lt;param name="beforeLabel"&amp;gt;foo(&amp;lt;/param&amp;gt; 
          &amp;lt;param name="afterLabel"&amp;gt;)&amp;lt;/param&amp;gt; 
      &amp;lt;/module&amp;gt;
   &amp;lt;/module&amp;gt;
&amp;lt;/view&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;However, the background color never changes depending on the dynamic value.&lt;/P&gt;

&lt;P&gt;If that is the case, the solution is to change your populating search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="os" foo earliest="-1m" |stats count 
| rangemap field=count red=0-0 default=green
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;to &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="os" foo earliest="-1m" |stats count 
| rangemap field=count low=0-0 elevated=1-1 default=severe
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;By default, the SingleValue module defines the following class -&amp;gt; color mappings:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;None     -&amp;gt; grey (#999)
low      -&amp;gt; green (#72c72d)
guarded  -&amp;gt; blue (#4da6df)
elevated -&amp;gt; yellow (#e9da34)
high     -&amp;gt; orange (#e67918)
severe   -&amp;gt; red (#bb2121)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;These values are defined in:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;$SPLUNK_HOME/share/splunk/search_mrsparkle/exposed/css/skins/default/default.css
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can override them at either the application level by editing the file:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;$SPLUNK_HOME/etc/apps/YOUR_APP_NAME/appserver/static/application.css
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;or at the view level by:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;Creating a custom view CSS file in the same directory as above&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;Linking a view to that custom view CSS by adding it to the view XML node, i.e.,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;view refresh="60" template="dashboard.html" stylesheet="my_custom_style.css"&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Finally, by editing the custom CSS, you can replace the SingleValue backgrounds entirely with different JPG, GIF, or PNG files based on the enumerations defined by the 'rangemap' command.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Nov 2009 08:09:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-use-the-SingleValue-module-to-color-code-search-results/m-p/9042#M3</guid>
      <dc:creator>Johnvey</dc:creator>
      <dc:date>2009-11-04T08:09:32Z</dc:date>
    </item>
  </channel>
</rss>

