<?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: conditional based query in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/conditional-based-query/m-p/508856#M33879</link>
    <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/223530"&gt;@lping&lt;/a&gt;&amp;nbsp;when you are trying to pass value from one dashboard to other you have to use form based URL tokens so instead of using &lt;STRONG&gt;host_tok&lt;/STRONG&gt; use &lt;STRONG&gt;form.host_tok&lt;/STRONG&gt;.&lt;/P&gt;</description>
    <pubDate>Mon, 13 Jul 2020 17:24:57 GMT</pubDate>
    <dc:creator>niketn</dc:creator>
    <dc:date>2020-07-13T17:24:57Z</dc:date>
    <item>
      <title>conditional based query</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/conditional-based-query/m-p/508278#M33805</link>
      <description>&lt;P&gt;I am passing token "host_tok" from dashboardA to dashboardB&lt;/P&gt;&lt;P&gt;Now I am trying to set the query based on token passed&lt;/P&gt;&lt;P&gt;XML for Dashboard B as below:&lt;BR /&gt;================&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;dashboard&amp;gt;
   &amp;lt;label&amp;gt;Consul Level 2 Errors&amp;lt;/label&amp;gt;
   &amp;lt;description&amp;gt;Gives stats on ERRORS&amp;lt;/description&amp;gt;
   &amp;lt;row&amp;gt;
      &amp;lt;panel&amp;gt;
         &amp;lt;single&amp;gt;
            &amp;lt;title&amp;gt;Number of Errors in last 5 minutes&amp;lt;/title&amp;gt;
            &amp;lt;search&amp;gt;
               &amp;lt;init&amp;gt;
                  &amp;lt;condition match="$host_tok$==&amp;amp;quot;consul_client&amp;amp;quot;"&amp;gt;
                     &amp;lt;set token="Panel1"&amp;gt;host!=*consul* OR servername!=*consul* earliest=-5m sourcetype=consul_log index=hcm_consul "[ERROR]" NOT ("rpc error making call: rpc error making call: Permission denied" OR "rpc error making call: Permission denied" OR "Newer Consul version available") | eval SEARCH_CRITERIA=case(like(_raw, "%Push/Pull with%"), "Push/Pull Error", like(_raw, "%Failed fallback ping%"), "Failed fallback ping Error", like(_raw, "%connection reset by peer%"), "Connection reset by peer Error", like(_raw, "%keepalive timeout%"), "Keepalive Timeout Error", like(_raw, "%i/o timeout%"), "I/O Timeout Error", like(_raw, "%lead thread didn't get connection%"), "Lead thread didn't get connection Error", like(_raw, "%failed to get conn: EOF%"), "Failed to get conn: EOF Error", like(_raw, "%rpc error making call: EOF%"), "RPC error making call: EOF Error", like(_raw, "%Permission denied%"), "Permission denied Error", like(_raw, "%Timeout exceeded while awaiting headers%"), "Timeout exceeded while awaiting headers Error", true(), "Other Error")| stats count by SEARCH_CRITERIA&amp;lt;/set&amp;gt;
                  &amp;lt;/condition&amp;gt;
                  &amp;lt;condition match="$host_tok$==&amp;amp;quot;consul_server&amp;amp;quot;"&amp;gt;
                     &amp;lt;set token="Panel1"&amp;gt;host=*consul* OR servername=*consul* earliest=-5m sourcetype=consul_log index=hcm_consul "[ERROR]" NOT ("rpc error making call: rpc error making call: Permission denied" OR "rpc error making call: Permission denied" OR "Newer Consul version available") | eval SEARCH_CRITERIA=case(like(_raw, "%Push/Pull with%"), "Push/Pull Error", like(_raw, "%Failed fallback ping%"), "Failed fallback ping Error", like(_raw, "%connection reset by peer%"), "Connection reset by peer Error", like(_raw, "%keepalive timeout%"), "Keepalive Timeout Error", like(_raw, "%i/o timeout%"), "I/O Timeout Error", like(_raw, "%lead thread didn't get connection%"), "Lead thread didn't get connection Error", like(_raw, "%failed to get conn: EOF%"), "Failed to get conn: EOF Error", like(_raw, "%rpc error making call: EOF%"), "RPC error making call: EOF Error", like(_raw, "%Permission denied%"), "Permission denied Error", like(_raw, "%Timeout exceeded while awaiting headers%"), "Timeout exceeded while awaiting headers Error", true(), "Other Error")| stats count by SEARCH_CRITERIA&amp;lt;/set&amp;gt;
                  &amp;lt;/condition&amp;gt;
               &amp;lt;/init&amp;gt;
               &amp;lt;query&amp;gt;$Panel1$&amp;lt;/query&amp;gt;
               &amp;lt;earliest&amp;gt;$earliest$&amp;lt;/earliest&amp;gt;
               &amp;lt;latest&amp;gt;$latest$&amp;lt;/latest&amp;gt;
               &amp;lt;refresh&amp;gt;1m&amp;lt;/refresh&amp;gt;
               &amp;lt;refreshType&amp;gt;delay&amp;lt;/refreshType&amp;gt;
            &amp;lt;/search&amp;gt;
            &amp;lt;option name="count"&amp;gt;10&amp;lt;/option&amp;gt;
            &amp;lt;option name="drilldown"&amp;gt;cell&amp;lt;/option&amp;gt;
         &amp;lt;/single&amp;gt;
      &amp;lt;/panel&amp;gt;
   &amp;lt;/row&amp;gt;
   &amp;lt;row&amp;gt;
      &amp;lt;panel&amp;gt;
         &amp;lt;chart&amp;gt;
            &amp;lt;title&amp;gt;Error's Trendline for Nodes in last 60 minutes&amp;lt;/title&amp;gt;
            &amp;lt;search&amp;gt;
               &amp;lt;query&amp;gt;$Panel2$&amp;lt;/query&amp;gt;
               &amp;lt;earliest&amp;gt;-60m@m&amp;lt;/earliest&amp;gt;
               &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
               &amp;lt;refresh&amp;gt;1m&amp;lt;/refresh&amp;gt;
            &amp;lt;/search&amp;gt;
            &amp;lt;option name="charting.axisLabelsX.majorLabelStyle.rotation"&amp;gt;45&amp;lt;/option&amp;gt;
            &amp;lt;option name="charting.chart"&amp;gt;line&amp;lt;/option&amp;gt;
         &amp;lt;/chart&amp;gt;
      &amp;lt;/panel&amp;gt;
   &amp;lt;/row&amp;gt;
&amp;lt;/dashboard&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;================&lt;/P&gt;&lt;P&gt;I am unable to get data its keep saying waiting for input.&lt;/P&gt;&lt;P&gt;Can you suggest how I can achieve two different queries based on token passed?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jul 2020 18:47:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/conditional-based-query/m-p/508278#M33805</guid>
      <dc:creator>lping</dc:creator>
      <dc:date>2020-07-09T18:47:04Z</dc:date>
    </item>
    <item>
      <title>Re: conditional based query</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/conditional-based-query/m-p/508384#M33831</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/223530"&gt;@lping&lt;/a&gt;&amp;nbsp; Based on your example seems like host_tok token value from source dashboard can only have two values i.e.&amp;nbsp;&lt;STRONG&gt;consul_client&lt;/STRONG&gt; or&amp;nbsp;&lt;STRONG&gt;consul_server&lt;/STRONG&gt;. In the destination dashboard if you do not want users to change this value have a hidden input consume the token and set required SPL accordingly. I have used a dropdown in the following example.&lt;/P&gt;&lt;P&gt;PS: &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Viz/EventHandlerReference#Search_event_handlers" target="_self"&gt;search event handlers&lt;/A&gt; can be &lt;STRONG&gt;&amp;lt;done&amp;gt;, &amp;lt;progress&amp;gt;, &amp;lt;fail&amp;gt;, &amp;lt;error&amp;gt; or &amp;lt;cancelled&amp;gt;&lt;/STRONG&gt;. The &lt;STRONG&gt;&amp;lt;init&amp;gt;&lt;/STRONG&gt; section is only for Dashboard load. Having said these you actually need an input and code &lt;STRONG&gt;&amp;lt;change&amp;gt;&lt;/STRONG&gt; event handler.&lt;BR /&gt;&lt;BR /&gt;I dont know from where you are getting $earliest$ and $latest$ for one of your panel while the other panel Search uses static time. If these tokens are also coming from the source dashboard's drilldown, you would need to create a time input as well and set the default value accordingly.&lt;/P&gt;&lt;P&gt;Please try out and confirm the following example based on your question:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;form&amp;gt;
  &amp;lt;label&amp;gt;Conditional Token&amp;lt;/label&amp;gt;
  &amp;lt;description&amp;gt;Gives stats on ERRORS&amp;lt;/description&amp;gt;
  &amp;lt;fieldset submitButton="false"&amp;gt;
    &amp;lt;input depends="$alwaysHide$" type="dropdown" token="host_tok" searchWhenChanged="true"&amp;gt;
      &amp;lt;label&amp;gt;&amp;lt;/label&amp;gt;
      &amp;lt;change&amp;gt;
        &amp;lt;condition value="consul_client"&amp;gt;
          &amp;lt;set token="Panel1"&amp;gt;host!=*consul* OR servername!=*consul* earliest=-5m sourcetype=consul_log index=hcm_consul "[ERROR]" NOT ("rpc error making call: rpc error making call: Permission denied" OR "rpc error making call: Permission denied" OR "Newer Consul version available") | eval SEARCH_CRITERIA=case(like(_raw, "%Push/Pull with%"), "Push/Pull Error", like(_raw, "%Failed fallback ping%"), "Failed fallback ping Error", like(_raw, "%connection reset by peer%"), "Connection reset by peer Error", like(_raw, "%keepalive timeout%"), "Keepalive Timeout Error", like(_raw, "%i/o timeout%"), "I/O Timeout Error", like(_raw, "%lead thread didn't get connection%"), "Lead thread didn't get connection Error", like(_raw, "%failed to get conn: EOF%"), "Failed to get conn: EOF Error", like(_raw, "%rpc error making call: EOF%"), "RPC error making call: EOF Error", like(_raw, "%Permission denied%"), "Permission denied Error", like(_raw, "%Timeout exceeded while awaiting headers%"), "Timeout exceeded while awaiting headers Error", true(), "Other Error")| stats count by SEARCH_CRITERIA&amp;lt;/set&amp;gt;
          &amp;lt;set token="Panel2"&amp;gt;| gentimes start=-10 
| eval _time=starttime 
| fields _time
| eval client=random()&amp;lt;/set&amp;gt;
        &amp;lt;/condition&amp;gt;
        &amp;lt;condition value="consul_server"&amp;gt;
          &amp;lt;set token="Panel1"&amp;gt;host=*consul* OR servername=*consul* earliest=-5m sourcetype=consul_log index=hcm_consul "[ERROR]" NOT ("rpc error making call: rpc error making call: Permission denied" OR "rpc error making call: Permission denied" OR "Newer Consul version available") | eval SEARCH_CRITERIA=case(like(_raw, "%Push/Pull with%"), "Push/Pull Error", like(_raw, "%Failed fallback ping%"), "Failed fallback ping Error", like(_raw, "%connection reset by peer%"), "Connection reset by peer Error", like(_raw, "%keepalive timeout%"), "Keepalive Timeout Error", like(_raw, "%i/o timeout%"), "I/O Timeout Error", like(_raw, "%lead thread didn't get connection%"), "Lead thread didn't get connection Error", like(_raw, "%failed to get conn: EOF%"), "Failed to get conn: EOF Error", like(_raw, "%rpc error making call: EOF%"), "RPC error making call: EOF Error", like(_raw, "%Permission denied%"), "Permission denied Error", like(_raw, "%Timeout exceeded while awaiting headers%"), "Timeout exceeded while awaiting headers Error", true(), "Other Error")| stats count by SEARCH_CRITERIA&amp;lt;/set&amp;gt;
          &amp;lt;set token="Panel2"&amp;gt;| gentimes start=-10 
| eval _time=starttime 
| fields _time
| eval server=random()&amp;lt;/set&amp;gt;
        &amp;lt;/condition&amp;gt;
      &amp;lt;/change&amp;gt;
      &amp;lt;choice value="consul_client"&amp;gt;Client&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="consul_server"&amp;gt;Server&amp;lt;/choice&amp;gt;
      &amp;lt;default&amp;gt;consul_client&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;single&amp;gt;
        &amp;lt;title&amp;gt;Number of Errors in last 5 minutes&amp;lt;/title&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;$Panel1$&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;$earliest$&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;$latest$&amp;lt;/latest&amp;gt;
          &amp;lt;refresh&amp;gt;1m&amp;lt;/refresh&amp;gt;
          &amp;lt;refreshType&amp;gt;delay&amp;lt;/refreshType&amp;gt;
        &amp;lt;/search&amp;gt;
      &amp;lt;/single&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;chart&amp;gt;
        &amp;lt;title&amp;gt;Error's Trendline for Nodes in last 60 minutes&amp;lt;/title&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;$Panel2$&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-60m@m&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
          &amp;lt;refresh&amp;gt;1m&amp;lt;/refresh&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="charting.axisLabelsX.majorLabelStyle.rotation"&amp;gt;45&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart"&amp;gt;line&amp;lt;/option&amp;gt;
      &amp;lt;/chart&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/form&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jul 2020 19:15:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/conditional-based-query/m-p/508384#M33831</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2020-07-09T19:15:33Z</dc:date>
    </item>
    <item>
      <title>Re: conditional based query</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/conditional-based-query/m-p/508853#M33876</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/201110"&gt;@niketn&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Thanks for your reply.&lt;/P&gt;&lt;P&gt;I tried the solution you have proposed and is close enough but only issue is when I click from Dashboard 1 my host_tok is been passed as&amp;nbsp;&lt;BR /&gt;&lt;A href="https://cloudsearch-dc2.cld.ondemand.com/en-US/app/search/dc2_consul_level2_errors_test?host_tok=%22consul_server%22" target="_blank"&gt;https://xyz.com/en-US/app/search/consul_level2_errors_test?host_tok="consul_server"&amp;amp;form.host_tok=&lt;/A&gt;&lt;BR /&gt;along with additional form.host_tok which cant be defaulted to any value.&lt;BR /&gt;&lt;BR /&gt;Basically my second dashboard need to consume host_tok and based on that it need to run the query set under condition tag.&lt;/P&gt;&lt;P&gt;Hope you can help me in fixing this issue.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jul 2020 16:55:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/conditional-based-query/m-p/508853#M33876</guid>
      <dc:creator>lping</dc:creator>
      <dc:date>2020-07-13T16:55:01Z</dc:date>
    </item>
    <item>
      <title>Re: conditional based query</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/conditional-based-query/m-p/508856#M33879</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/223530"&gt;@lping&lt;/a&gt;&amp;nbsp;when you are trying to pass value from one dashboard to other you have to use form based URL tokens so instead of using &lt;STRONG&gt;host_tok&lt;/STRONG&gt; use &lt;STRONG&gt;form.host_tok&lt;/STRONG&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jul 2020 17:24:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/conditional-based-query/m-p/508856#M33879</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2020-07-13T17:24:57Z</dc:date>
    </item>
    <item>
      <title>Re: conditional based query</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/conditional-based-query/m-p/509009#M33896</link>
      <description>&lt;P&gt;Thanks for your help&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/201110"&gt;@niketn&lt;/a&gt;&amp;nbsp; It works perfectly.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jul 2020 08:10:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/conditional-based-query/m-p/509009#M33896</guid>
      <dc:creator>lping</dc:creator>
      <dc:date>2020-07-14T08:10:30Z</dc:date>
    </item>
    <item>
      <title>Re: conditional based query</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/conditional-based-query/m-p/509121#M33902</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/223530"&gt;@lping&lt;/a&gt;&amp;nbsp;you should have accepted the previous elaborate answer, as that covered the solution for the issue posted. However, do upvote the comments / answers that assisted resolving your issue!&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jul 2020 18:44:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/conditional-based-query/m-p/509121#M33902</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2020-07-14T18:44:47Z</dc:date>
    </item>
  </channel>
</rss>

