<?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: eval if command with returned value = all from dropdown list in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/eval-if-command-with-returned-value-all-from-dropdown-list/m-p/336971#M99985</link>
    <description>&lt;P&gt;Hey krusovice,&lt;/P&gt;

&lt;P&gt;Is your city field already extracted?&lt;BR /&gt;
If yes, then rather than writing eval you can try something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=* | search city=$city$ 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In this case, if you select all, city will be selected as city=* and that should help!!&lt;/P&gt;

&lt;P&gt;Let me know if this worked!!&lt;/P&gt;</description>
    <pubDate>Fri, 09 Mar 2018 06:47:17 GMT</pubDate>
    <dc:creator>deepashri_123</dc:creator>
    <dc:date>2018-03-09T06:47:17Z</dc:date>
    <item>
      <title>eval if command with returned value = all from dropdown list</title>
      <link>https://community.splunk.com/t5/Splunk-Search/eval-if-command-with-returned-value-all-from-dropdown-list/m-p/336969#M99983</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;

&lt;P&gt;I'm forming the eval query based on the value extracted from dropdown token. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval city=if((_raw LIKE "%$city$%"),"$city$","0" )
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Issue here is that the dropdown is having All=* configured. If user chosen "All" from the dropdown list, the "city" token will be equal to 0, which is not correct. &lt;/P&gt;

&lt;P&gt;How can I pass all the "city" value to the next query if All is selected?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Mar 2018 06:41:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/eval-if-command-with-returned-value-all-from-dropdown-list/m-p/336969#M99983</guid>
      <dc:creator>krusovice</dc:creator>
      <dc:date>2018-03-09T06:41:59Z</dc:date>
    </item>
    <item>
      <title>Re: eval if command with returned value = all from dropdown list</title>
      <link>https://community.splunk.com/t5/Splunk-Search/eval-if-command-with-returned-value-all-from-dropdown-list/m-p/336970#M99984</link>
      <description>&lt;P&gt;why you wont try simply&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | eval city="$city$"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Mar 2018 06:46:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/eval-if-command-with-returned-value-all-from-dropdown-list/m-p/336970#M99984</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2018-03-09T06:46:38Z</dc:date>
    </item>
    <item>
      <title>Re: eval if command with returned value = all from dropdown list</title>
      <link>https://community.splunk.com/t5/Splunk-Search/eval-if-command-with-returned-value-all-from-dropdown-list/m-p/336971#M99985</link>
      <description>&lt;P&gt;Hey krusovice,&lt;/P&gt;

&lt;P&gt;Is your city field already extracted?&lt;BR /&gt;
If yes, then rather than writing eval you can try something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=* | search city=$city$ 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In this case, if you select all, city will be selected as city=* and that should help!!&lt;/P&gt;

&lt;P&gt;Let me know if this worked!!&lt;/P&gt;</description>
      <pubDate>Fri, 09 Mar 2018 06:47:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/eval-if-command-with-returned-value-all-from-dropdown-list/m-p/336971#M99985</guid>
      <dc:creator>deepashri_123</dc:creator>
      <dc:date>2018-03-09T06:47:17Z</dc:date>
    </item>
    <item>
      <title>Re: eval if command with returned value = all from dropdown list</title>
      <link>https://community.splunk.com/t5/Splunk-Search/eval-if-command-with-returned-value-all-from-dropdown-list/m-p/336972#M99986</link>
      <description>&lt;P&gt;why do not you just try &lt;CODE&gt;city="$city$"&lt;/CODE&gt; to pass the city value?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Mar 2018 06:50:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/eval-if-command-with-returned-value-all-from-dropdown-list/m-p/336972#M99986</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2018-03-09T06:50:08Z</dc:date>
    </item>
    <item>
      <title>Re: eval if command with returned value = all from dropdown list</title>
      <link>https://community.splunk.com/t5/Splunk-Search/eval-if-command-with-returned-value-all-from-dropdown-list/m-p/336973#M99987</link>
      <description>&lt;P&gt;hi @493669 and @deepashri,&lt;/P&gt;

&lt;P&gt;Both solution not working. There is no "city=" to be matched in the log. the $city$ field is from dropdown list (e.g. All, London, Mancester....etc). &lt;/P&gt;

&lt;P&gt;Solution provided by @493669 still returning as "*".&lt;/P&gt;</description>
      <pubDate>Fri, 09 Mar 2018 06:56:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/eval-if-command-with-returned-value-all-from-dropdown-list/m-p/336973#M99987</guid>
      <dc:creator>krusovice</dc:creator>
      <dc:date>2018-03-09T06:56:46Z</dc:date>
    </item>
    <item>
      <title>Re: eval if command with returned value = all from dropdown list</title>
      <link>https://community.splunk.com/t5/Splunk-Search/eval-if-command-with-returned-value-all-from-dropdown-list/m-p/336974#M99988</link>
      <description>&lt;P&gt;how are you getting events from the dropdown list? is it coming from lookup? or you are extracting it at search time ?&lt;BR /&gt;
it would be great if you share sample events and xml for your current dashboard.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Mar 2018 06:58:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/eval-if-command-with-returned-value-all-from-dropdown-list/m-p/336974#M99988</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2018-03-09T06:58:55Z</dc:date>
    </item>
    <item>
      <title>Re: eval if command with returned value = all from dropdown list</title>
      <link>https://community.splunk.com/t5/Splunk-Search/eval-if-command-with-returned-value-all-from-dropdown-list/m-p/336975#M99989</link>
      <description>&lt;P&gt;In what scenario you are using &lt;CODE&gt;$city$&lt;/CODE&gt; token? if you could share what output you are expecting...&lt;/P&gt;</description>
      <pubDate>Fri, 09 Mar 2018 07:07:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/eval-if-command-with-returned-value-all-from-dropdown-list/m-p/336975#M99989</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2018-03-09T07:07:29Z</dc:date>
    </item>
    <item>
      <title>Re: eval if command with returned value = all from dropdown list</title>
      <link>https://community.splunk.com/t5/Splunk-Search/eval-if-command-with-returned-value-all-from-dropdown-list/m-p/336976#M99990</link>
      <description>&lt;P&gt;No it is not working. city token is from dropdown list. There is no such field "city=" in the log. My simplified query as below:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=* "Country: $clicked_country$ - CITY: $city$" 
| eval country=if((_raw LIKE "%$clicked_country$%"),"$clicked_country$","0")
| eval city=if((_raw LIKE "%$city$%"),"$city$","0")
| stats values(date_hour) as "Hour" by country city
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Mar 2018 07:11:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/eval-if-command-with-returned-value-all-from-dropdown-list/m-p/336976#M99990</guid>
      <dc:creator>krusovice</dc:creator>
      <dc:date>2018-03-09T07:11:13Z</dc:date>
    </item>
    <item>
      <title>Re: eval if command with returned value = all from dropdown list</title>
      <link>https://community.splunk.com/t5/Splunk-Search/eval-if-command-with-returned-value-all-from-dropdown-list/m-p/336977#M99991</link>
      <description>&lt;P&gt;city token from dropdown list is extracted using regex to catch the "city" in the log.&lt;/P&gt;

&lt;P&gt;Sample log:&lt;BR /&gt;
    Request_A - Country: GERMANY - City: BER&lt;/P&gt;</description>
      <pubDate>Fri, 09 Mar 2018 07:15:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/eval-if-command-with-returned-value-all-from-dropdown-list/m-p/336977#M99991</guid>
      <dc:creator>krusovice</dc:creator>
      <dc:date>2018-03-09T07:15:04Z</dc:date>
    </item>
    <item>
      <title>Re: eval if command with returned value = all from dropdown list</title>
      <link>https://community.splunk.com/t5/Splunk-Search/eval-if-command-with-returned-value-all-from-dropdown-list/m-p/336978#M99992</link>
      <description>&lt;P&gt;Desired output in table format as explained in:&lt;/P&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/624710/formatting-output-in-table.html"&gt;https://answers.splunk.com/answers/624710/formatting-output-in-table.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Mar 2018 07:17:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/eval-if-command-with-returned-value-all-from-dropdown-list/m-p/336978#M99992</guid>
      <dc:creator>krusovice</dc:creator>
      <dc:date>2018-03-09T07:17:16Z</dc:date>
    </item>
    <item>
      <title>Re: eval if command with returned value = all from dropdown list</title>
      <link>https://community.splunk.com/t5/Splunk-Search/eval-if-command-with-returned-value-all-from-dropdown-list/m-p/336979#M99993</link>
      <description>&lt;P&gt;why do not you extract city and country to make your job easier I see from the events they are in standard format.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=_raw "Country\:\s(?&amp;lt;country&amp;gt;[^\s]+)\s\-\sCity\:\s(?&amp;lt;city&amp;gt;[^\s]+)" | search city="$city$"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and then use &lt;CODE&gt;*&lt;/CODE&gt; as a wildcard for &lt;CODE&gt;ALL&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;From your current search query you need to substitute &lt;CODE&gt;*&lt;/CODE&gt; for the main search and &lt;CODE&gt;%&lt;/CODE&gt; for the eval statement.&lt;/P&gt;

&lt;P&gt;let me know if this helps!&lt;/P&gt;</description>
      <pubDate>Fri, 09 Mar 2018 07:25:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/eval-if-command-with-returned-value-all-from-dropdown-list/m-p/336979#M99993</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2018-03-09T07:25:12Z</dc:date>
    </item>
    <item>
      <title>Re: eval if command with returned value = all from dropdown list</title>
      <link>https://community.splunk.com/t5/Splunk-Search/eval-if-command-with-returned-value-all-from-dropdown-list/m-p/336980#M99994</link>
      <description>&lt;P&gt;try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=*|  rex field=_raw "Country\:\s(?&amp;lt;country&amp;gt;[^\s]+).*City\:\s(?&amp;lt;city&amp;gt;[^\s]+)"
| search city="$city$" AND country="$clicked_country$"
 | stats values(date_hour) as "Hour" by country city
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Mar 2018 07:35:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/eval-if-command-with-returned-value-all-from-dropdown-list/m-p/336980#M99994</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2018-03-09T07:35:13Z</dc:date>
    </item>
    <item>
      <title>Re: eval if command with returned value = all from dropdown list</title>
      <link>https://community.splunk.com/t5/Splunk-Search/eval-if-command-with-returned-value-all-from-dropdown-list/m-p/336981#M99995</link>
      <description>&lt;P&gt;Yes it is working fine now after several tests. Thanks to @mayurr98 and @493669.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Mar 2018 02:42:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/eval-if-command-with-returned-value-all-from-dropdown-list/m-p/336981#M99995</guid>
      <dc:creator>krusovice</dc:creator>
      <dc:date>2018-03-12T02:42:58Z</dc:date>
    </item>
  </channel>
</rss>

