<?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 to make single visualization switches to table? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-make-single-visualization-switches-to-table/m-p/368939#M108739</link>
    <description>&lt;P&gt;Thanks so much, I would really appreciate an example!&lt;/P&gt;</description>
    <pubDate>Tue, 20 Mar 2018 20:23:46 GMT</pubDate>
    <dc:creator>mauricio2354</dc:creator>
    <dc:date>2018-03-20T20:23:46Z</dc:date>
    <item>
      <title>How to make single visualization switches to table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-make-single-visualization-switches-to-table/m-p/368937#M108737</link>
      <description>&lt;P&gt;I have a query that outputs a table with services and their failure rates. I want it to be a green box that says "No Failing Services" if there are no services that are failing; but if there are, have a red box that lists all the failing services. I'm a bit new to Splunk and don't know to change visualizations/design too well. &lt;/P&gt;</description>
      <pubDate>Tue, 20 Mar 2018 17:36:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-make-single-visualization-switches-to-table/m-p/368937#M108737</guid>
      <dc:creator>mauricio2354</dc:creator>
      <dc:date>2018-03-20T17:36:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to make single visualization switches to table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-make-single-visualization-switches-to-table/m-p/368938#M108738</link>
      <description>&lt;P&gt;Are you putting this in a dashboard?  I assume you are, so here is how I would tackle that.&lt;/P&gt;

&lt;P&gt;I would create 2 dashboard panels with a &lt;CODE&gt;depends&lt;/CODE&gt; attribute.  I will try to get you an example today.&lt;/P&gt;

&lt;P&gt;UPDATE:  An example &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Here is the code in text format to copy and paste.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;dashboard&amp;gt;
  &amp;lt;label&amp;gt;Depends Test&amp;lt;/label&amp;gt;
  &amp;lt;search&amp;gt;
    &amp;lt;query&amp;gt;index=_internal log_level=error earliest=-60m &amp;lt;/query&amp;gt;
    &amp;lt;done&amp;gt;
      &amp;lt;condition match=" 'job.resultCount' == 0"&amp;gt;
        &amp;lt;set token="display_green"&amp;gt;true&amp;lt;/set&amp;gt;
      &amp;lt;/condition&amp;gt;
      &amp;lt;condition&amp;gt;
        &amp;lt;unset token="display_green"&amp;gt;&amp;lt;/unset&amp;gt;
      &amp;lt;/condition&amp;gt;
    &amp;lt;/done&amp;gt;
  &amp;lt;/search&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel depends="$display_green$"&amp;gt;
      &amp;lt;title&amp;gt;Green Panel&amp;lt;/title&amp;gt;
      &amp;lt;single&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;index=_internal log_level=error earliest=-60m | stats count&amp;lt;/query&amp;gt;
        &amp;lt;/search&amp;gt;
      &amp;lt;/single&amp;gt;
    &amp;lt;/panel&amp;gt;
    &amp;lt;panel rejects="$display_green$"&amp;gt;
      &amp;lt;title&amp;gt;Red Panel&amp;lt;/title&amp;gt;
      &amp;lt;table&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;index=_internal log_level=error earliest=-60m&amp;lt;/query&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>Tue, 20 Mar 2018 18:02:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-make-single-visualization-switches-to-table/m-p/368938#M108738</guid>
      <dc:creator>lycollicott</dc:creator>
      <dc:date>2018-03-20T18:02:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to make single visualization switches to table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-make-single-visualization-switches-to-table/m-p/368939#M108739</link>
      <description>&lt;P&gt;Thanks so much, I would really appreciate an example!&lt;/P&gt;</description>
      <pubDate>Tue, 20 Mar 2018 20:23:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-make-single-visualization-switches-to-table/m-p/368939#M108739</guid>
      <dc:creator>mauricio2354</dc:creator>
      <dc:date>2018-03-20T20:23:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to make single visualization switches to table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-make-single-visualization-switches-to-table/m-p/368940#M108740</link>
      <description>&lt;P&gt;Did you have a chance to test my example?&lt;/P&gt;</description>
      <pubDate>Thu, 22 Mar 2018 18:07:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-make-single-visualization-switches-to-table/m-p/368940#M108740</guid>
      <dc:creator>lycollicott</dc:creator>
      <dc:date>2018-03-22T18:07:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to make single visualization switches to table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-make-single-visualization-switches-to-table/m-p/368941#M108741</link>
      <description>&lt;P&gt;@mauricio2354, please try the following run anywhere dashboard based on Splunk's _internal index which displays a table with Failure Rate Column as &lt;CODE&gt;Red&lt;/CODE&gt; and otherwise a single value with Green background color overridden through CSS and static No Failure message.&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/4586i4889E7EC8BBD82AC/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;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  &amp;lt;label&amp;gt;Switch between No Results and Table&amp;lt;/label&amp;gt;
  &amp;lt;fieldset submitButton="false"&amp;gt;
    &amp;lt;input type="time" token="tokTime" searchWhenChanged="true"&amp;gt;
      &amp;lt;label&amp;gt;&amp;lt;/label&amp;gt;
      &amp;lt;default&amp;gt;
        &amp;lt;earliest&amp;gt;-5m&amp;lt;/earliest&amp;gt;
        &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
      &amp;lt;/default&amp;gt;
    &amp;lt;/input&amp;gt;
  &amp;lt;/fieldset&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;table depends="$sohwTable$"&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;index=_internal sourcetype=splunkd log_level="ERROR"
| stats count as ErrorCount by component
| rename component as Service&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;$tokTime.earliest$&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;$tokTime.latest$&amp;lt;/latest&amp;gt;
          &amp;lt;sampleRatio&amp;gt;1&amp;lt;/sampleRatio&amp;gt;
          &amp;lt;done&amp;gt;
            &amp;lt;condition match="$job.resultCount$==0"&amp;gt;
              &amp;lt;unset token="sohwTable"&amp;gt;&amp;lt;/unset&amp;gt;
            &amp;lt;/condition&amp;gt;
            &amp;lt;condition&amp;gt;
              &amp;lt;set token="sohwTable"&amp;gt;true&amp;lt;/set&amp;gt;
            &amp;lt;/condition&amp;gt;
          &amp;lt;/done&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="count"&amp;gt;20&amp;lt;/option&amp;gt;
        &amp;lt;option name="dataOverlayMode"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="percentagesRow"&amp;gt;false&amp;lt;/option&amp;gt;
        &amp;lt;option name="refresh.display"&amp;gt;progressbar&amp;lt;/option&amp;gt;
        &amp;lt;option name="rowNumbers"&amp;gt;true&amp;lt;/option&amp;gt;
        &amp;lt;option name="totalsRow"&amp;gt;false&amp;lt;/option&amp;gt;
        &amp;lt;option name="wrap"&amp;gt;true&amp;lt;/option&amp;gt;
        &amp;lt;format type="color" field="ErrorCount"&amp;gt;
          &amp;lt;colorPalette type="list"&amp;gt;[#D93F3C]&amp;lt;/colorPalette&amp;gt;
          &amp;lt;scale type="threshold"&amp;gt;&amp;lt;/scale&amp;gt;
        &amp;lt;/format&amp;gt;
      &amp;lt;/table&amp;gt;
      &amp;lt;single id="singleOkMessage" rejects="$sohwTable$"&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;| makeresults
            | fields - _time          
            | eval Message=0
            | rangemap field=Message green=0-0 default=green
            | replace "0" with "No Service Errors" in Message
          &amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;$tokTime.earliest$&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;$tokTime.latest$&amp;lt;/latest&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="colorMode"&amp;gt;block&amp;lt;/option&amp;gt;
        &amp;lt;option name="rangeColors"&amp;gt;["0x65a637","0x65a637"]&amp;lt;/option&amp;gt;
        &amp;lt;option name="rangeValues"&amp;gt;[0]&amp;lt;/option&amp;gt;
        &amp;lt;option name="useColors"&amp;gt;1&amp;lt;/option&amp;gt;
      &amp;lt;/single&amp;gt;
      &amp;lt;!-- HTML panel for applying Green Background color for Single Value panel with id="singleOkMessage" and always hidden --&amp;gt;
      &amp;lt;html depends="$alwaysHideCSSStyle$"&amp;gt;
        &amp;lt;style&amp;gt;
          #singleOkMessage .block-background{
            fill: green !important;
          }
        &amp;lt;/style&amp;gt;
      &amp;lt;/html&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;@lycollicott, since the use case is for Service Failures. No Failures is green Single Value and Failure is Red Table. Second the search query which sets the token to Green or Red based on result count can actually be placed inside the Red table.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Mar 2018 20:04:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-make-single-visualization-switches-to-table/m-p/368941#M108741</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-03-22T20:04:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to make single visualization switches to table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-make-single-visualization-switches-to-table/m-p/368942#M108742</link>
      <description>&lt;P&gt;I was only addressing how to control the panela, not the visualizations.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Mar 2018 12:38:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-make-single-visualization-switches-to-table/m-p/368942#M108742</guid>
      <dc:creator>lycollicott</dc:creator>
      <dc:date>2018-03-23T12:38:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to make single visualization switches to table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-make-single-visualization-switches-to-table/m-p/368943#M108743</link>
      <description>&lt;P&gt;Thanks for this amazing answer niketnilay! I was able to use this to incorporate our own query&lt;/P&gt;</description>
      <pubDate>Mon, 26 Mar 2018 14:49:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-make-single-visualization-switches-to-table/m-p/368943#M108743</guid>
      <dc:creator>mauricio2354</dc:creator>
      <dc:date>2018-03-26T14:49:36Z</dc:date>
    </item>
  </channel>
</rss>

