<?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 create a dynamic gauge visualization with subsearches? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-dynamic-gauge-visualization-with-subsearches/m-p/315963#M20292</link>
    <description>&lt;P&gt;@droopy4096 You can use &lt;STRONG&gt;gauge&lt;/STRONG&gt; command for defining dynamic range.&lt;/P&gt;

&lt;P&gt;Following is the base search you need:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; sourcetype=mytype status=failed AND log{}.message="*"
| stats count as failedTotal count(eval(log{}.message!="completed")) as failedIncomplete
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then set the tokens for &lt;STRONG&gt;failedTotal&lt;/STRONG&gt; and &lt;STRONG&gt;failedInComplete&lt;/STRONG&gt; as Total and Incomplete using &lt;STRONG&gt;finalized&lt;/STRONG&gt; search event handler&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;finalized&amp;gt;
  &amp;lt;condition match="$job.resultCount$==0"&amp;gt;
    &amp;lt;set token="Total"&amp;gt;0&amp;lt;/set&amp;gt;
    &amp;lt;set token="Incomplete"&amp;gt;0&amp;lt;/set&amp;gt;
  &amp;lt;/condition&amp;gt;
  &amp;lt;condition&amp;gt;
    &amp;lt;set token="Total"&amp;gt;$result.failedTotal$&amp;lt;/set&amp;gt;
    &amp;lt;set token="Incomplete"&amp;gt;$result.failedIncomplete$&amp;lt;/set&amp;gt;
  &amp;lt;/condition&amp;gt;
&amp;lt;/finalized&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Finally use &lt;STRONG&gt;$Total$&lt;/STRONG&gt; and &lt;STRONG&gt;$Incomplete$&lt;/STRONG&gt; in your search with Radial Gauge visualization to plot &lt;STRONG&gt;$InComplete$&lt;/STRONG&gt; with various ranges&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    &amp;lt;panel&amp;gt;
      &amp;lt;title&amp;gt;Failed Incomplete Total&amp;lt;/title&amp;gt;
      &amp;lt;chart&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;| makeresults
| eval incomplete=$Incomplete$
| eval greenUpper=round($Total$*.70,0)
| eval yellowUpper=round($Total$*.85,0)
| gauge incomplete 0 greenUpper yellowUpper $Total$&amp;lt;/query&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="charting.chart"&amp;gt;radialGauge&amp;lt;/option&amp;gt;
      &amp;lt;/chart&amp;gt;
    &amp;lt;/panel&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;PS: Once you have Failed Incomplete and Failed Total values, instead of plotting actual values, it would make more sense to plot &lt;STRONG&gt;percent&lt;/STRONG&gt; in the Radial Gauge for consistency in visualization using approach similar to above. &lt;/P&gt;

&lt;P&gt;Refer to the &lt;STRONG&gt;run anywhere example on similar lines&lt;/STRONG&gt; that I have posted on the link below: &lt;BR /&gt;
&lt;A href="http://wiki.splunk.com/User_talk:Niketnilay#Topic_3:_Dynamic_Range_for_Gauges:_Example_to_Calculate_Event_Percentage_and_dynamically_decide_ranges_for_the_gauge_command"&gt;http://wiki.splunk.com/User_talk:Niketnilay#Topic_3:_Dynamic_Range_for_Gauges:_Example_to_Calculate_Event_Percentage_and_dynamically_decide_ranges_for_the_gauge_command&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Image attached for reference from run anywhere search in the example above.&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/2731i1C866D7DDA2FA3BA/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>Sun, 09 Apr 2017 09:44:19 GMT</pubDate>
    <dc:creator>niketn</dc:creator>
    <dc:date>2017-04-09T09:44:19Z</dc:date>
    <item>
      <title>How to create a dynamic gauge visualization with subsearches?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-dynamic-gauge-visualization-with-subsearches/m-p/315962#M20291</link>
      <description>&lt;P&gt;I'm trying to put together the gauge widget that would use different searches to set up the limits and set the needle.&lt;BR /&gt;
so for example I have base search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=mytype
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now to figure out full range for the gauge here's the search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=mytype status=failed
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;For the needle position search extends to:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; sourcetype=mytype status=failed AND NOT log{}.message="completed"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;to identify non-critical failure rate. Being fairly new to Splunk I'm struggling putting this together. extracting the value from the last search is no problem but default range of 100 is not applicable and range changes dynamically throughout the day.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Apr 2017 15:58:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-dynamic-gauge-visualization-with-subsearches/m-p/315962#M20291</guid>
      <dc:creator>droopy4096</dc:creator>
      <dc:date>2017-04-07T15:58:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a dynamic gauge visualization with subsearches?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-dynamic-gauge-visualization-with-subsearches/m-p/315963#M20292</link>
      <description>&lt;P&gt;@droopy4096 You can use &lt;STRONG&gt;gauge&lt;/STRONG&gt; command for defining dynamic range.&lt;/P&gt;

&lt;P&gt;Following is the base search you need:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; sourcetype=mytype status=failed AND log{}.message="*"
| stats count as failedTotal count(eval(log{}.message!="completed")) as failedIncomplete
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then set the tokens for &lt;STRONG&gt;failedTotal&lt;/STRONG&gt; and &lt;STRONG&gt;failedInComplete&lt;/STRONG&gt; as Total and Incomplete using &lt;STRONG&gt;finalized&lt;/STRONG&gt; search event handler&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;finalized&amp;gt;
  &amp;lt;condition match="$job.resultCount$==0"&amp;gt;
    &amp;lt;set token="Total"&amp;gt;0&amp;lt;/set&amp;gt;
    &amp;lt;set token="Incomplete"&amp;gt;0&amp;lt;/set&amp;gt;
  &amp;lt;/condition&amp;gt;
  &amp;lt;condition&amp;gt;
    &amp;lt;set token="Total"&amp;gt;$result.failedTotal$&amp;lt;/set&amp;gt;
    &amp;lt;set token="Incomplete"&amp;gt;$result.failedIncomplete$&amp;lt;/set&amp;gt;
  &amp;lt;/condition&amp;gt;
&amp;lt;/finalized&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Finally use &lt;STRONG&gt;$Total$&lt;/STRONG&gt; and &lt;STRONG&gt;$Incomplete$&lt;/STRONG&gt; in your search with Radial Gauge visualization to plot &lt;STRONG&gt;$InComplete$&lt;/STRONG&gt; with various ranges&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    &amp;lt;panel&amp;gt;
      &amp;lt;title&amp;gt;Failed Incomplete Total&amp;lt;/title&amp;gt;
      &amp;lt;chart&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;| makeresults
| eval incomplete=$Incomplete$
| eval greenUpper=round($Total$*.70,0)
| eval yellowUpper=round($Total$*.85,0)
| gauge incomplete 0 greenUpper yellowUpper $Total$&amp;lt;/query&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="charting.chart"&amp;gt;radialGauge&amp;lt;/option&amp;gt;
      &amp;lt;/chart&amp;gt;
    &amp;lt;/panel&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;PS: Once you have Failed Incomplete and Failed Total values, instead of plotting actual values, it would make more sense to plot &lt;STRONG&gt;percent&lt;/STRONG&gt; in the Radial Gauge for consistency in visualization using approach similar to above. &lt;/P&gt;

&lt;P&gt;Refer to the &lt;STRONG&gt;run anywhere example on similar lines&lt;/STRONG&gt; that I have posted on the link below: &lt;BR /&gt;
&lt;A href="http://wiki.splunk.com/User_talk:Niketnilay#Topic_3:_Dynamic_Range_for_Gauges:_Example_to_Calculate_Event_Percentage_and_dynamically_decide_ranges_for_the_gauge_command"&gt;http://wiki.splunk.com/User_talk:Niketnilay#Topic_3:_Dynamic_Range_for_Gauges:_Example_to_Calculate_Event_Percentage_and_dynamically_decide_ranges_for_the_gauge_command&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Image attached for reference from run anywhere search in the example above.&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/2731i1C866D7DDA2FA3BA/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>Sun, 09 Apr 2017 09:44:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-dynamic-gauge-visualization-with-subsearches/m-p/315963#M20292</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-04-09T09:44:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a dynamic gauge visualization with subsearches?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-dynamic-gauge-visualization-with-subsearches/m-p/315964#M20293</link>
      <description>&lt;P&gt;I think I've sorted out query issues:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=mytype  status=failed  | stats count as failedTotal, count(eval('log{}.message!="completed"')) as failedComplete
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;this seems to work. &lt;/P&gt;

&lt;P&gt;Now my problem is that I'm not sure what to do about the search handler:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;"finalized" is not listed in docs: &lt;A href="https://docs.splunk.com/Documentation/Splunk/6.5.2/Viz/EventHandlerReference#Search_event_handlers"&gt;https://docs.splunk.com/Documentation/Splunk/6.5.2/Viz/EventHandlerReference#Search_event_handlers&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;your sample shows "query" tag, but that is already filled. Am I supposed to just append that tag's content to whatever my current "query" tag contains? &lt;/LI&gt;
&lt;LI&gt;is there a full source of the panel using method you describe? That would probably answer most of above points.&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Mon, 10 Apr 2017 15:56:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-dynamic-gauge-visualization-with-subsearches/m-p/315964#M20293</guid>
      <dc:creator>droopy4096</dc:creator>
      <dc:date>2017-04-10T15:56:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a dynamic gauge visualization with subsearches?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-dynamic-gauge-visualization-with-subsearches/m-p/315965#M20294</link>
      <description>&lt;P&gt;If you have just one radial gauge. I would make it simple... Just try the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;     &amp;lt;panel&amp;gt;
       &amp;lt;title&amp;gt;Failed Incomplete Total&amp;lt;/title&amp;gt;
       &amp;lt;chart&amp;gt;
         &amp;lt;search&amp;gt;
           &amp;lt;query&amp;gt;sourcetype=mytype status=failed AND log{}.message="*"
 | stats count as Total count(eval(log{}.message!="completed")) as incomplete
 | eval greenUpper=round(Total*.70,0)
 | eval yellowUpper=round(Total*.85,0)
 | gauge incomplete 0 greenUpper yellowUpper Total&amp;lt;/query&amp;gt;
         &amp;lt;/search&amp;gt;
         &amp;lt;option name="charting.chart"&amp;gt;radialGauge&amp;lt;/option&amp;gt;
       &amp;lt;/chart&amp;gt;
     &amp;lt;/panel&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 10 Apr 2017 16:22:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-dynamic-gauge-visualization-with-subsearches/m-p/315965#M20294</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-04-10T16:22:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a dynamic gauge visualization with subsearches?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-dynamic-gauge-visualization-with-subsearches/m-p/315966#M20295</link>
      <description>&lt;P&gt;Seems like the preview and finalized were removed from 6.5 (although they still work). Instead use progress or done event handlers which can access &lt;CODE&gt;$result.&amp;lt;fieldname&amp;gt;$&lt;/CODE&gt; token. For this example &lt;STRONG&gt;done&lt;/STRONG&gt; should be used. Please see updated answer above.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Viz/EventHandlerReference#done"&gt;http://docs.splunk.com/Documentation/Splunk/latest/Viz/EventHandlerReference#done&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Apr 2017 20:57:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-dynamic-gauge-visualization-with-subsearches/m-p/315966#M20295</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-04-10T20:57:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a dynamic gauge visualization with subsearches?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-dynamic-gauge-visualization-with-subsearches/m-p/315967#M20296</link>
      <description>&lt;P&gt;@droopy4096...I have reverted back the event handler to &lt;STRONG&gt;finalized&lt;/STRONG&gt; again, seems like although the documentation lists that done event handler has access to &lt;CODE&gt;$result.&amp;lt;fieldname&amp;gt;$&lt;/CODE&gt;, but it actually does not... So just try preview or finalized instead.&lt;/P&gt;

&lt;P&gt;Please try out the example and let me know how it goes.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2017 01:45:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-dynamic-gauge-visualization-with-subsearches/m-p/315967#M20296</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-04-12T01:45:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a dynamic gauge visualization with subsearches?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-dynamic-gauge-visualization-with-subsearches/m-p/315968#M20297</link>
      <description>&lt;P&gt;will tinker with implementation later - I've got some stuff cobbled together thanks to your pointers, but didn't have time to properly implement it. My first attempt at implementation failed so I've got to look deeper&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2017 20:46:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-dynamic-gauge-visualization-with-subsearches/m-p/315968#M20297</guid>
      <dc:creator>droopy4096</dc:creator>
      <dc:date>2017-04-12T20:46:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a dynamic gauge visualization with subsearches?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-dynamic-gauge-visualization-with-subsearches/m-p/315969#M20298</link>
      <description>&lt;P&gt;Sure @droopy4096... When you get a chance try out and revert back here as to how it goes.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Apr 2017 03:54:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-create-a-dynamic-gauge-visualization-with-subsearches/m-p/315969#M20298</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-04-13T03:54:20Z</dc:date>
    </item>
  </channel>
</rss>

