<?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 how to format single value chart based on multiple occurrances in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-format-single-value-chart-based-on-multiple-occurrances/m-p/371814#M39308</link>
    <description>&lt;P&gt;Hello,&lt;BR /&gt;
   I'd like to create a single value chart, based on below search, to display the number of invalid objects in a database. I would like to format in red (critical) when there is at least one invalid object from OWNER "SYS" or "SYSTEM", yellow (warning) if there is invalid object is coming from any other owner than "SYS" and "SYSTEM". Green if there isn't any invalid object in the database. It would be desirable if the count to display were the total of invalid objects in the database.&lt;/P&gt;

&lt;P&gt;sourcetype=oracle:object STATUS!=VALID | stats count by OWNER&lt;/P&gt;

&lt;P&gt;OWNER        COUNT&lt;BR /&gt;
SYS                     1&lt;BR /&gt;
MYCUST            2&lt;/P&gt;

&lt;P&gt;Any help will be really appreciated.&lt;/P&gt;</description>
    <pubDate>Tue, 27 Jun 2017 02:15:45 GMT</pubDate>
    <dc:creator>romoc</dc:creator>
    <dc:date>2017-06-27T02:15:45Z</dc:date>
    <item>
      <title>how to format single value chart based on multiple occurrances</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-format-single-value-chart-based-on-multiple-occurrances/m-p/371814#M39308</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;
   I'd like to create a single value chart, based on below search, to display the number of invalid objects in a database. I would like to format in red (critical) when there is at least one invalid object from OWNER "SYS" or "SYSTEM", yellow (warning) if there is invalid object is coming from any other owner than "SYS" and "SYSTEM". Green if there isn't any invalid object in the database. It would be desirable if the count to display were the total of invalid objects in the database.&lt;/P&gt;

&lt;P&gt;sourcetype=oracle:object STATUS!=VALID | stats count by OWNER&lt;/P&gt;

&lt;P&gt;OWNER        COUNT&lt;BR /&gt;
SYS                     1&lt;BR /&gt;
MYCUST            2&lt;/P&gt;

&lt;P&gt;Any help will be really appreciated.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jun 2017 02:15:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-format-single-value-chart-based-on-multiple-occurrances/m-p/371814#M39308</guid>
      <dc:creator>romoc</dc:creator>
      <dc:date>2017-06-27T02:15:45Z</dc:date>
    </item>
    <item>
      <title>Re: how to format single value chart based on multiple occurrances</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-format-single-value-chart-based-on-multiple-occurrances/m-p/371815#M39309</link>
      <description>&lt;P&gt;if you need to use the above query, you could try "Splunk 6.x Dashboard Examples" app, which got a "rangemap" that will be suitable for your task.&lt;BR /&gt;
&lt;A href="https://splunkbase.splunk.com/app/1603/"&gt;https://splunkbase.splunk.com/app/1603/&lt;/A&gt;&lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/3127iBC50F0208032A271/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;for single value, the search query should generate only one numerical output.&lt;BR /&gt;
so you can use - &lt;BR /&gt;
&lt;PRE&gt;sourcetype=oracle:object STATUS!=VALID OWNER=SYS | stats count&lt;/PRE&gt;&lt;BR /&gt;
then using the format options, you can apply color settings. &lt;/P&gt;

&lt;P&gt;everytime, manually applying color, maybe looks like a strange task. but this will be useful for real time count monitors, or you can save it as a dashboard and when you open the dashboard, the query will be run and color will be automatically selected. &lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/3128i612D294D5BE1A82C/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jun 2017 05:17:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-format-single-value-chart-based-on-multiple-occurrances/m-p/371815#M39309</guid>
      <dc:creator>inventsekar</dc:creator>
      <dc:date>2017-06-27T05:17:03Z</dc:date>
    </item>
    <item>
      <title>Re: how to format single value chart based on multiple occurrances</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-format-single-value-chart-based-on-multiple-occurrances/m-p/371816#M39310</link>
      <description>&lt;P&gt;Since you do not just want Color ranges by count rather want Color Ranges based on fields and count, I would suggest going for &lt;STRONG&gt;Status Indicator Custom Visualization&lt;/STRONG&gt; (&lt;A href="https://splunkbase.splunk.com/app/3119/"&gt;https://splunkbase.splunk.com/app/3119/&lt;/A&gt;). Further your requirement is to have only one panel with Single value based on priority of results i.e. Red, Yellow Green (respectively), which makes the required code a bit tricky.&lt;/P&gt;

&lt;P&gt;Following query will decide whether the Panel is Red, Yellow Or Green.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=oracle:object STATUS!="VALID" 
| stats count by OWNER
| appendcols [| makeresults 
              | eval count=0
              | eval OWNER="Ok"
              | fields - _time]
| eval Icon=case(OWNER=="SYS" OR OWNER=="SYSTEM","times-circle",OWNER=="Ok","check-circle",true(),"exclaimation-circle")
| stats sum(count) as Count by Icon
| transpose header_field="Icon" column_name="Icon"
| eval filter=case('times-circle'&amp;gt;0,"times-circle",'exclamation-circle'&amp;gt;0,"exclaimaton-circle",true(),"check-circle")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You will then need to use Search Event Handler to pass on the required values Count, Icon and Color to Status Indicator Viz.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;      &amp;lt;done&amp;gt;
        &amp;lt;!-- Check Red condition first if true then set Red Values --&amp;gt;
        &amp;lt;condition match="$result.filter$==&amp;amp;quot;times-circle&amp;amp;quot;"&amp;gt;
          &amp;lt;set token="tokCount"&amp;gt;$result.times-circle$&amp;lt;/set&amp;gt;
          &amp;lt;set token="tokIcon"&amp;gt;times-circle&amp;lt;/set&amp;gt;
          &amp;lt;set token="tokColor"&amp;gt;#ff0000&amp;lt;/set&amp;gt;
        &amp;lt;/condition&amp;gt;
        &amp;lt;!-- Check Yellow condition second if true then set Yellow Values --&amp;gt;
        &amp;lt;condition match="$result.filter$==&amp;amp;quot;exclamation-circle&amp;amp;quot;"&amp;gt;
          &amp;lt;set token="tokCount"&amp;gt;$result.exclamation-circle$&amp;lt;/set&amp;gt;
          &amp;lt;set token="tokIcon"&amp;gt;exclamation-circle&amp;lt;/set&amp;gt;
          &amp;lt;set token="tokColor"&amp;gt;#ffc200&amp;lt;/set&amp;gt;
        &amp;lt;/condition&amp;gt;
        &amp;lt;!-- Check Green condition in the end if true then set Green Values --&amp;gt;
        &amp;lt;condition match="$result.filter$==&amp;amp;quot;check-circle&amp;amp;quot;"&amp;gt;
          &amp;lt;set token="tokCount"&amp;gt;$result.check-circle$&amp;lt;/set&amp;gt;
          &amp;lt;set token="tokIcon"&amp;gt;check-circle&amp;lt;/set&amp;gt;
          &amp;lt;set token="tokColor"&amp;gt;#008000&amp;lt;/set&amp;gt;
        &amp;lt;/condition&amp;gt;
      &amp;lt;/done&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;When there is no results for INVALID status by any OWNER, appendcols will add Ok (Green) Status Row. times_circle icon and #ff0000 represent &lt;STRONG&gt;Red&lt;/STRONG&gt;, exclaimation-circle icon and #ffc200 represent &lt;STRONG&gt;Yellow&lt;/STRONG&gt; and check-circle icon and #008000 represent &lt;STRONG&gt;Green&lt;/STRONG&gt;. Refer to documentation on Status Indicator for details - &lt;A href="https://docs.splunk.com/Documentation/StatusIndicator/latest/StatusIndicatorViz/StatusIndicatorSearchDataFormat"&gt;https://docs.splunk.com/Documentation/StatusIndicator/latest/StatusIndicatorViz/StatusIndicatorSearchDataFormat&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Following is run anywhere example using Splunk's _internal index :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  &amp;lt;!-- Query to find Status Indicator Count Icon and Color --&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;table&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;index=_internal sourcetype=splunkd log_level!="INFO"
    | stats count by log_level
    | appendcols [| makeresults 
          | eval count=0
          | eval log_level="Ok"
          | fields - _time]
    | eval Icon=case(log_level=="ERROR" OR log_level=="WARN","times-circle",log_level=="Ok","check-circle",true(),"exclaimation-circle")
    | stats sum(count) as Count by Icon
    | transpose header_field="Icon" column_name="Icon"
    | eval filter=case('times-circle'&amp;gt;0,"times-circle",'exclamation-circle'&amp;gt;0,"exclaimaton-circle",true(),"check-circle")&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;@d&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
          &amp;lt;sampleRatio&amp;gt;1&amp;lt;/sampleRatio&amp;gt;
          &amp;lt;done&amp;gt;
            &amp;lt;!-- Check Red condition first if true then set Red Values --&amp;gt;
            &amp;lt;condition match="$result.filter$==&amp;amp;quot;times-circle&amp;amp;quot;"&amp;gt;
              &amp;lt;set token="tokCount"&amp;gt;$result.times-circle$&amp;lt;/set&amp;gt;
              &amp;lt;set token="tokIcon"&amp;gt;times-circle&amp;lt;/set&amp;gt;
              &amp;lt;set token="tokColor"&amp;gt;#ff0000&amp;lt;/set&amp;gt;
            &amp;lt;/condition&amp;gt;
            &amp;lt;!-- Check Yellow condition second if true then set Yellow Values --&amp;gt;
            &amp;lt;condition match="$result.filter$==&amp;amp;quot;exclamation-circle&amp;amp;quot;"&amp;gt;
              &amp;lt;set token="tokCount"&amp;gt;$result.exclamation-circle$&amp;lt;/set&amp;gt;
              &amp;lt;set token="tokIcon"&amp;gt;exclamation-circle&amp;lt;/set&amp;gt;
              &amp;lt;set token="tokColor"&amp;gt;#ffc200&amp;lt;/set&amp;gt;
            &amp;lt;/condition&amp;gt;
            &amp;lt;!-- Check Green condition in the end if true then set Green Values --&amp;gt;
            &amp;lt;condition match="$result.filter$==&amp;amp;quot;check-circle&amp;amp;quot;"&amp;gt;
              &amp;lt;set token="tokCount"&amp;gt;$result.check-circle$&amp;lt;/set&amp;gt;
              &amp;lt;set token="tokIcon"&amp;gt;check-circle&amp;lt;/set&amp;gt;
              &amp;lt;set token="tokColor"&amp;gt;#008000&amp;lt;/set&amp;gt;
            &amp;lt;/condition&amp;gt;
          &amp;lt;/done&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
      &amp;lt;/table&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;viz type="status_indicator_app.status_indicator"&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;| makeresults 
              | eval count=$tokCount$
              | eval icon="$tokIcon$"
              | eval color="$tokColor$"
              | table count icon color&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;@d&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
          &amp;lt;sampleRatio&amp;gt;1&amp;lt;/sampleRatio&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="height"&amp;gt;100&amp;lt;/option&amp;gt;
        &amp;lt;option name="status_indicator_app.status_indicator.colorBy"&amp;gt;field_value&amp;lt;/option&amp;gt;
        &amp;lt;option name="status_indicator_app.status_indicator.fillTarget"&amp;gt;background&amp;lt;/option&amp;gt;
        &amp;lt;option name="status_indicator_app.status_indicator.fixIcon"&amp;gt;warning&amp;lt;/option&amp;gt;
        &amp;lt;option name="status_indicator_app.status_indicator.icon"&amp;gt;field_value&amp;lt;/option&amp;gt;
        &amp;lt;option name="status_indicator_app.status_indicator.precision"&amp;gt;0&amp;lt;/option&amp;gt;
        &amp;lt;option name="status_indicator_app.status_indicator.showOption"&amp;gt;1&amp;lt;/option&amp;gt;
        &amp;lt;option name="status_indicator_app.status_indicator.staticColor"&amp;gt;#555&amp;lt;/option&amp;gt;
        &amp;lt;option name="status_indicator_app.status_indicator.useColors"&amp;gt;true&amp;lt;/option&amp;gt;
        &amp;lt;option name="status_indicator_app.status_indicator.useThousandSeparator"&amp;gt;true&amp;lt;/option&amp;gt;
      &amp;lt;/viz&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 27 Jun 2017 06:50:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-format-single-value-chart-based-on-multiple-occurrances/m-p/371816#M39310</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-06-27T06:50:06Z</dc:date>
    </item>
    <item>
      <title>Re: how to format single value chart based on multiple occurrances</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-format-single-value-chart-based-on-multiple-occurrances/m-p/371817#M39311</link>
      <description>&lt;P&gt;Thanks niketnilay - looks like it's what we were looking for. I will be working on get it implemented.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jun 2017 22:56:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-format-single-value-chart-based-on-multiple-occurrances/m-p/371817#M39311</guid>
      <dc:creator>romoc</dc:creator>
      <dc:date>2017-06-27T22:56:43Z</dc:date>
    </item>
  </channel>
</rss>

