<?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: variable where clause in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/variable-where-clause/m-p/31771#M6608</link>
    <description>&lt;P&gt;Make sure that you list the fields in the original search that you will need in the drilldown. Otherwise your parent module won't pass down the fields.&lt;/P&gt;

&lt;P&gt;Example:&lt;BR /&gt;
Parent:&lt;BR /&gt;
search "blah" | fields firstname, age&lt;BR /&gt;
Drilldown:&lt;BR /&gt;
search firstname=$click.name1$ AND lastname=$click.name2$ | table firstname, lastname, age&lt;/P&gt;

&lt;P&gt;The above won't work, because your parent module will not pass the "lastname" field to the child module.&lt;/P&gt;

&lt;P&gt;To make it work just include all the fields that you will need downstream in your parent module.&lt;/P&gt;</description>
    <pubDate>Mon, 13 May 2013 20:01:05 GMT</pubDate>
    <dc:creator>aholzer</dc:creator>
    <dc:date>2013-05-13T20:01:05Z</dc:date>
    <item>
      <title>variable where clause</title>
      <link>https://community.splunk.com/t5/Splunk-Search/variable-where-clause/m-p/31766#M6603</link>
      <description>&lt;P&gt;Hi, &lt;/P&gt;

&lt;P&gt;I need to set where clause based on certain condition. For example, if value=a, then where should be x&amp;gt;1. If value=b, then where clause should have x&amp;gt;100. If value=c, then x&amp;gt;1000, etc.&lt;/P&gt;

&lt;P&gt;So I did something like:&lt;/P&gt;

&lt;PRE&gt;
eval condition=if(value=a,x&amp;gt;1,if(value=b,x&amp;gt;100,x&amp;gt;1000)) | stats values(blahblah) | where condition
&lt;/PRE&gt;

&lt;P&gt;As expected, that doesn't work =D&lt;/P&gt;

&lt;P&gt;Please help and let me know how I can set up variable where clause.&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 13 May 2013 19:18:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/variable-where-clause/m-p/31766#M6603</guid>
      <dc:creator>lain179</dc:creator>
      <dc:date>2013-05-13T19:18:57Z</dc:date>
    </item>
    <item>
      <title>Re: variable where clause</title>
      <link>https://community.splunk.com/t5/Splunk-Search/variable-where-clause/m-p/31767#M6604</link>
      <description>&lt;P&gt;just move the conditional logic into the eval and have the eval create a field whose value is 1 or 0.   then your where clause can just check for 1.   &lt;/P&gt;

&lt;P&gt;Like so: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eval is_match=case(value=="a" AND x&amp;gt;1,1,value=="b" AND x&amp;gt;100,1,x&amp;gt;1000,1,1==1,0) | stats values(blahblah) | where is_match="1"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 May 2013 19:32:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/variable-where-clause/m-p/31767#M6604</guid>
      <dc:creator>sideview</dc:creator>
      <dc:date>2013-05-13T19:32:00Z</dc:date>
    </item>
    <item>
      <title>Re: variable where clause</title>
      <link>https://community.splunk.com/t5/Splunk-Search/variable-where-clause/m-p/31768#M6605</link>
      <description>&lt;P&gt;May be I am doing something wrong:&lt;/P&gt;

&lt;P&gt;My search:&lt;/P&gt;

&lt;PRE&gt;
sourcetype="WMI*Security" Type="Audit Failure" Account_Name=* AND NOT (Account_Name=@@*) AND Client_Host=$click.value$| stats values(Account_Name) | where conditional | eval conditional = case($click.name2$ = InternalCount AND len(Account_Name)=3, 1,$click.name2$=AdminCount AND like(Account_Name,"%admin%"),1,$click.name2$=ClientCount AND len(Account_Name)!=3,1,1==1,0) | stats values(Account_Name) | where conditional="1"

&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 May 2013 19:39:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/variable-where-clause/m-p/31768#M6605</guid>
      <dc:creator>lain179</dc:creator>
      <dc:date>2013-05-13T19:39:10Z</dc:date>
    </item>
    <item>
      <title>Re: variable where clause</title>
      <link>https://community.splunk.com/t5/Splunk-Search/variable-where-clause/m-p/31769#M6606</link>
      <description>&lt;P&gt;My search result&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;The job appears to have expired or has been canceled. Splunk could not retrieve data for this search.&lt;/EM&gt;&lt;/P&gt;

&lt;PRE&gt;
sourcetype="WMI*Security" Type="Audit Failure" Account_Name=* AND NOT (Account_Name=@@*) AND Client_Host=HL112SPRAX04| stats values(Account_Name) | where conditional | eval conditional = case(ClientCount = InternalCount AND len(Account_Name)=3, 1,ClientCount=AdminCount AND like(Account_Name,"%admin%"),1,ClientCount=ClientCount AND len(Account_Name)!=3,1,1==1,0) | stats values(Account_Name) | where conditional="1"

&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 May 2013 19:39:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/variable-where-clause/m-p/31769#M6606</guid>
      <dc:creator>lain179</dc:creator>
      <dc:date>2013-05-13T19:39:15Z</dc:date>
    </item>
    <item>
      <title>Re: variable where clause</title>
      <link>https://community.splunk.com/t5/Splunk-Search/variable-where-clause/m-p/31770#M6607</link>
      <description>&lt;P&gt;Run this same search, but end it after the &lt;CODE&gt;| stats values(Account_Name)&lt;/CODE&gt;   I'm not sure what you think stats values() does, but it doesn't do that. &lt;span class="lia-unicode-emoji" title=":grinning_face_with_big_eyes:"&gt;😃&lt;/span&gt;    after that stats vlaues clause you'll have exactly one row, with exactly one field,  whose field name is "values(AccountName)".  So nothing after that will work as you expect.  Also the extra &lt;CODE&gt;| where conditional |&lt;/CODE&gt; clause looks like a typo.&lt;/P&gt;</description>
      <pubDate>Mon, 13 May 2013 19:57:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/variable-where-clause/m-p/31770#M6607</guid>
      <dc:creator>sideview</dc:creator>
      <dc:date>2013-05-13T19:57:45Z</dc:date>
    </item>
    <item>
      <title>Re: variable where clause</title>
      <link>https://community.splunk.com/t5/Splunk-Search/variable-where-clause/m-p/31771#M6608</link>
      <description>&lt;P&gt;Make sure that you list the fields in the original search that you will need in the drilldown. Otherwise your parent module won't pass down the fields.&lt;/P&gt;

&lt;P&gt;Example:&lt;BR /&gt;
Parent:&lt;BR /&gt;
search "blah" | fields firstname, age&lt;BR /&gt;
Drilldown:&lt;BR /&gt;
search firstname=$click.name1$ AND lastname=$click.name2$ | table firstname, lastname, age&lt;/P&gt;

&lt;P&gt;The above won't work, because your parent module will not pass the "lastname" field to the child module.&lt;/P&gt;

&lt;P&gt;To make it work just include all the fields that you will need downstream in your parent module.&lt;/P&gt;</description>
      <pubDate>Mon, 13 May 2013 20:01:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/variable-where-clause/m-p/31771#M6608</guid>
      <dc:creator>aholzer</dc:creator>
      <dc:date>2013-05-13T20:01:05Z</dc:date>
    </item>
    <item>
      <title>Re: variable where clause</title>
      <link>https://community.splunk.com/t5/Splunk-Search/variable-where-clause/m-p/31772#M6609</link>
      <description>&lt;P&gt;Both of you are correct. It was a stupid typo. Here is my new search and it works!!! Thanks guys.&lt;/P&gt;

&lt;PRE&gt;
sourcetype="WMI*Security" Type="Audit Failure" Account_Name=* AND NOT (Account_Name=@@*) AND Client_Host=$click.value$ | eval status= if(len(Account_Name)=3, "InternalCount", if(like(Account_Name,"%admin%"),"AdminCount","ClientCount")) | stats values(Account_Name) values(status) as status by _time | where status="$click.name2$"

&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 May 2013 20:44:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/variable-where-clause/m-p/31772#M6609</guid>
      <dc:creator>lain179</dc:creator>
      <dc:date>2013-05-13T20:44:32Z</dc:date>
    </item>
  </channel>
</rss>

