<?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: Can you help me with my conditional search query involving a token? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Can-you-help-me-with-my-conditional-search-query-involving-a/m-p/444833#M29275</link>
    <description>&lt;P&gt;you can try like this if token is &lt;CODE&gt;*&lt;/CODE&gt; then change to blank and if it is not &lt;CODE&gt;*&lt;/CODE&gt; then it will remain same-&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|eval token = if(token="*","",token)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 24 Oct 2018 16:17:30 GMT</pubDate>
    <dc:creator>493669</dc:creator>
    <dc:date>2018-10-24T16:17:30Z</dc:date>
    <item>
      <title>Can you help me with my conditional search query involving a token?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Can-you-help-me-with-my-conditional-search-query-involving-a/m-p/444830#M29272</link>
      <description>&lt;P&gt;i have a search , which gets an input token as "*" for one of the columns.&lt;/P&gt;

&lt;P&gt;i want the search to not run the query if token comes as "&lt;EM&gt;" . But, I want it to run if the token actually has some other value other than "&lt;/EM&gt;"&lt;/P&gt;

&lt;P&gt;can you help me figure out how to write this query, below is an example..&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;index= test_index testcolumn="*" |table _time,testcolumn,column2&lt;/CODE&gt; - &amp;gt; This should not run as it runs against all values.&lt;/P&gt;

&lt;P&gt;but&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;index= test_index testcolumn="manualvalue" |table _time,testcolumn,column2&lt;/CODE&gt;  - &amp;gt; This should run as it runs against only 1 value.&lt;/P&gt;

&lt;P&gt;Any ideas how to get this working, as it's the same token&lt;/P&gt;</description>
      <pubDate>Wed, 24 Oct 2018 15:46:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Can-you-help-me-with-my-conditional-search-query-involving-a/m-p/444830#M29272</guid>
      <dc:creator>jiaqya</dc:creator>
      <dc:date>2018-10-24T15:46:29Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me with my conditional search query involving a token?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Can-you-help-me-with-my-conditional-search-query-involving-a/m-p/444831#M29273</link>
      <description>&lt;P&gt;why don't you change token value in input &lt;/P&gt;</description>
      <pubDate>Wed, 24 Oct 2018 15:59:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Can-you-help-me-with-my-conditional-search-query-involving-a/m-p/444831#M29273</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2018-10-24T15:59:53Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me with my conditional search query involving a token?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Can-you-help-me-with-my-conditional-search-query-involving-a/m-p/444832#M29274</link>
      <description>&lt;P&gt;I Cant change that token value in input.&lt;/P&gt;

&lt;P&gt;reason is that i use that token = "*" for another panel to show full data in bar format.&lt;/P&gt;

&lt;P&gt;but i also need that same token to show by individual record in another panel on the same dashboard.&lt;/P&gt;

&lt;P&gt;so i am guessing i have to do it in the individual search query , but dont know how to..&lt;/P&gt;</description>
      <pubDate>Wed, 24 Oct 2018 16:03:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Can-you-help-me-with-my-conditional-search-query-involving-a/m-p/444832#M29274</guid>
      <dc:creator>jiaqya</dc:creator>
      <dc:date>2018-10-24T16:03:39Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me with my conditional search query involving a token?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Can-you-help-me-with-my-conditional-search-query-involving-a/m-p/444833#M29275</link>
      <description>&lt;P&gt;you can try like this if token is &lt;CODE&gt;*&lt;/CODE&gt; then change to blank and if it is not &lt;CODE&gt;*&lt;/CODE&gt; then it will remain same-&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|eval token = if(token="*","",token)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 24 Oct 2018 16:17:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Can-you-help-me-with-my-conditional-search-query-involving-a/m-p/444833#M29275</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2018-10-24T16:17:30Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me with my conditional search query involving a token?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Can-you-help-me-with-my-conditional-search-query-involving-a/m-p/444834#M29276</link>
      <description>&lt;P&gt;Tried this, but this does not work .  the "*"  asterix is the problem as it does not allow me to replace the token...since it represents "All" . any other ideas ?&lt;/P&gt;</description>
      <pubDate>Wed, 24 Oct 2018 16:50:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Can-you-help-me-with-my-conditional-search-query-involving-a/m-p/444834#M29276</guid>
      <dc:creator>jiaqya</dc:creator>
      <dc:date>2018-10-24T16:50:59Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me with my conditional search query involving a token?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Can-you-help-me-with-my-conditional-search-query-involving-a/m-p/444835#M29277</link>
      <description>&lt;P&gt;@jiaqya try the following run anywhere example. The token &lt;CODE&gt;tokLogLevelFinalFilter&lt;/CODE&gt; is used to filter search results. When &lt;CODE&gt;All&lt;/CODE&gt; is selected in dropdown (&lt;CODE&gt;$label$&lt;/CODE&gt;), then the token is unset. When any other value is selected in the dropdown, it is set to dropdown value (&lt;CODE&gt;$value$&lt;/CODE&gt;).&lt;/P&gt;

&lt;P&gt;Please try out and confirm!&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  &amp;lt;label&amp;gt;Token Unset for All&amp;lt;/label&amp;gt;
  &amp;lt;fieldset submitButton="false"&amp;gt;
    &amp;lt;input type="dropdown" token="tokLogLevel" searchWhenChanged="true"&amp;gt;
      &amp;lt;label&amp;gt;Dropdown&amp;lt;/label&amp;gt;
      &amp;lt;choice value="*"&amp;gt;All&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="ERROR"&amp;gt;Error&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="WARN"&amp;gt;Warn&amp;lt;/choice&amp;gt;
      &amp;lt;change&amp;gt;
        &amp;lt;condition label="All"&amp;gt;
          &amp;lt;unset token="tokLogLevelFinalFilter"&amp;gt;&amp;lt;/unset&amp;gt;
        &amp;lt;/condition&amp;gt;
        &amp;lt;condition&amp;gt;
          &amp;lt;set token="tokLogLevelFinalFilter"&amp;gt;$value$&amp;lt;/set&amp;gt;
        &amp;lt;/condition&amp;gt;
      &amp;lt;/change&amp;gt;
      &amp;lt;default&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;html&amp;gt;
        &amp;lt;b&amp;gt;Log Level set to $tokLogLevelFinalFilter$&amp;lt;/b&amp;gt;
      &amp;lt;/html&amp;gt;
      &amp;lt;!-- Add depends="$tokLogLevelFinalFilter$" to table to hide table when Search is not running --&amp;gt;
      &amp;lt;table&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;index=_internal sourcetype=splunkd log_level="$tokLogLevelFinalFilter$"
| chart count by log_level component where max in top5
          &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;/form&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 24 Oct 2018 19:55:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Can-you-help-me-with-my-conditional-search-query-involving-a/m-p/444835#M29277</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-10-24T19:55:10Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me with my conditional search query involving a token?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Can-you-help-me-with-my-conditional-search-query-involving-a/m-p/444836#M29278</link>
      <description>&lt;P&gt;This works to some extent, i am able to get the values to change now for token.&lt;BR /&gt;
but when i choose a manual value, it does not refresh immediately.&lt;BR /&gt;
instead, i see the chosen value when i choose it again, ie , it lags one click behind.&lt;/P&gt;

&lt;P&gt;is there a way to get this to refresh on making the manual choice..&lt;/P&gt;</description>
      <pubDate>Thu, 25 Oct 2018 05:19:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Can-you-help-me-with-my-conditional-search-query-involving-a/m-p/444836#M29278</guid>
      <dc:creator>jiaqya</dc:creator>
      <dc:date>2018-10-25T05:19:36Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me with my conditional search query involving a token?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Can-you-help-me-with-my-conditional-search-query-involving-a/m-p/444837#M29279</link>
      <description>&lt;P&gt;Niket, as i said it worked to some extent, later i used a match instead of using equals and it works perfectly fine now, thanks for your help..&lt;/P&gt;

&lt;P&gt;The code that worked for me:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;      &amp;lt;condition match="value!=&amp;amp;quot;*&amp;amp;quot;"&amp;gt;
        &amp;lt;set token="hostname"&amp;gt;$value$&amp;lt;/set&amp;gt;
      &amp;lt;/condition&amp;gt;
      &amp;lt;condition match="value=&amp;amp;quot;*&amp;amp;quot;"&amp;gt;
        &amp;lt;set token="hostanme"&amp;gt;QueryCanceled&amp;lt;/set&amp;gt;
      &amp;lt;/condition&amp;gt;
    &amp;lt;/change&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 25 Oct 2018 09:18:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Can-you-help-me-with-my-conditional-search-query-involving-a/m-p/444837#M29279</guid>
      <dc:creator>jiaqya</dc:creator>
      <dc:date>2018-10-25T09:18:40Z</dc:date>
    </item>
  </channel>
</rss>

