<?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 splunk if else in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/splunk-if-else/m-p/449821#M29571</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have a drop down with list of components . i want to a have a panel which will show stats count by service if component=A is selcted and stats count by component if rest components are selected from the drop down menu .&lt;/P&gt;

&lt;P&gt;Is it posiible ?&lt;BR /&gt;
I tried using  &lt;/P&gt;

&lt;P&gt;Thanks &lt;/P&gt;</description>
    <pubDate>Sat, 21 Jul 2018 22:50:07 GMT</pubDate>
    <dc:creator>Mohsin123</dc:creator>
    <dc:date>2018-07-21T22:50:07Z</dc:date>
    <item>
      <title>splunk if else</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/splunk-if-else/m-p/449821#M29571</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have a drop down with list of components . i want to a have a panel which will show stats count by service if component=A is selcted and stats count by component if rest components are selected from the drop down menu .&lt;/P&gt;

&lt;P&gt;Is it posiible ?&lt;BR /&gt;
I tried using  &lt;/P&gt;

&lt;P&gt;Thanks &lt;/P&gt;</description>
      <pubDate>Sat, 21 Jul 2018 22:50:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/splunk-if-else/m-p/449821#M29571</guid>
      <dc:creator>Mohsin123</dc:creator>
      <dc:date>2018-07-21T22:50:07Z</dc:date>
    </item>
    <item>
      <title>Re: splunk if else</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/splunk-if-else/m-p/449822#M29572</link>
      <description>&lt;P&gt;@shraddhamuduli,&lt;/P&gt;

&lt;P&gt;You could do it by conditional token. Please find below the run anywhere example.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  &amp;lt;label&amp;gt;Conditional Drop Down&amp;lt;/label&amp;gt;
  &amp;lt;fieldset submitButton="false"&amp;gt;
    &amp;lt;input type="dropdown" token="component"&amp;gt;
      &amp;lt;label&amp;gt;component&amp;lt;/label&amp;gt;
      &amp;lt;fieldForLabel&amp;gt;component&amp;lt;/fieldForLabel&amp;gt;
      &amp;lt;fieldForValue&amp;gt;component&amp;lt;/fieldForValue&amp;gt;
      &amp;lt;search&amp;gt;
        &amp;lt;query&amp;gt;|tstats count where index=_* by component|fields - count|append [|stats count|eval component="the_special_component"]&amp;lt;/query&amp;gt;
        &amp;lt;earliest&amp;gt;-15m&amp;lt;/earliest&amp;gt;
        &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
      &amp;lt;/search&amp;gt;
      &amp;lt;change&amp;gt;
        &amp;lt;condition value="the_special_component"&amp;gt;
          &amp;lt;set token="service_or_component"&amp;gt;sourcetype&amp;lt;/set&amp;gt;
        &amp;lt;/condition&amp;gt;
        &amp;lt;condition&amp;gt;
          &amp;lt;set token="service_or_component"&amp;gt;component&amp;lt;/set&amp;gt;
        &amp;lt;/condition&amp;gt;
      &amp;lt;/change&amp;gt;
    &amp;lt;/input&amp;gt;
  &amp;lt;/fieldset&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel depends="$component$"&amp;gt;
      &amp;lt;title&amp;gt;This panel is group by $service_or_component$&amp;lt;/title&amp;gt;
      &amp;lt;table&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;index=_*|stats count by $service_or_component$&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-15m&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;now&amp;lt;/latest&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;/form&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Main elements are below&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;         &amp;lt;condition value="the_special_component"&amp;gt;
           &amp;lt;set token="service_or_component"&amp;gt;sourcetype&amp;lt;/set&amp;gt;
         &amp;lt;/condition&amp;gt;
         &amp;lt;condition&amp;gt;
           &amp;lt;set token="service_or_component"&amp;gt;component&amp;lt;/set&amp;gt;
         &amp;lt;/condition&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;When the value of component is &lt;CODE&gt;the_special_component&lt;/CODE&gt;, it sets the token as &lt;CODE&gt;sourcetype&lt;/CODE&gt; (service in your case) and token is set to &lt;CODE&gt;component&lt;/CODE&gt; in all other cases. Finally you will be using the token &lt;CODE&gt;service_or_component&lt;/CODE&gt; in group by statement.&lt;/P&gt;

&lt;P&gt;Hope it helps!&lt;/P&gt;</description>
      <pubDate>Sun, 22 Jul 2018 00:55:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/splunk-if-else/m-p/449822#M29572</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2018-07-22T00:55:29Z</dc:date>
    </item>
    <item>
      <title>Re: splunk if else</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/splunk-if-else/m-p/449823#M29573</link>
      <description>&lt;P&gt;Hi Renjith&lt;/P&gt;

&lt;P&gt;Thanks. But, your first query sets the dropdown to only one value i.e APIX &lt;BR /&gt;
Here APIX is my "the_special_component"&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:34:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/splunk-if-else/m-p/449823#M29573</guid>
      <dc:creator>Mohsin123</dc:creator>
      <dc:date>2020-09-29T20:34:40Z</dc:date>
    </item>
    <item>
      <title>Re: splunk if else</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/splunk-if-else/m-p/449824#M29574</link>
      <description>&lt;P&gt;what i mean is, this line is setting the drop down to only one value i.e the_special_component&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;     &amp;lt;query&amp;gt;|tstats count where index=idx_apix by component|fields - count|append [|stats count|eval component="the_special_component"]&amp;lt;/query&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:34:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/splunk-if-else/m-p/449824#M29574</guid>
      <dc:creator>Mohsin123</dc:creator>
      <dc:date>2020-09-29T20:34:44Z</dc:date>
    </item>
    <item>
      <title>Re: splunk if else</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/splunk-if-else/m-p/449825#M29575</link>
      <description>&lt;P&gt;You could just do the normal search instead of above and populate the dropdown. However , logic in the dashboard should work for you.&lt;BR /&gt;
Or do you mean that you have multiple values which needs to be compared?&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jul 2018 16:29:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/splunk-if-else/m-p/449825#M29575</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2018-07-23T16:29:49Z</dc:date>
    </item>
  </channel>
</rss>

