<?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: How to pass a value to the |inputlookup where , inside a subsearch in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-pass-a-value-to-the-inputlookup-where-inside-a-subsearch/m-p/367321#M108355</link>
    <description>&lt;P&gt;I want to pass application name from my main search to the subsearch to use it to filter values in the inputlookup and extract the values I want to use to filter the main search.&lt;/P&gt;

&lt;P&gt;My csv files has application, filter_field , filter_values, prod_issue, timestamp, user.  I don't care about the last 2 columns...   my subquery takes those columns and for each prod_issue make a parenthesis set with OR statements between them.. inside the parenthesis is has &lt;CODE&gt;application=myservice AND field1_prod_issue1=value AND field2_prod_issue1=value&lt;/CODE&gt; for each field / value pair that exists per prod_issue, as shown in the example above.  They way I currently have it set up, it works fine, except it pulls all of the for every application...but I only want it to pull the field / value pairs for the application currently being searched for, not EVERY possible combination.&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 18:01:23 GMT</pubDate>
    <dc:creator>AVOLLMER</dc:creator>
    <dc:date>2020-09-29T18:01:23Z</dc:date>
    <item>
      <title>How to pass a value to the |inputlookup where , inside a subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-pass-a-value-to-the-inputlookup-where-inside-a-subsearch/m-p/367317#M108351</link>
      <description>&lt;P&gt;I have a search:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;index=examp1 sourcetype=json application=myservice&lt;BR /&gt;
NOT [|inputlookup aps_test_filter.csv where application=&amp;lt;&amp;gt;| fields application prod_issue filter_field filter_values| eval {filter_field}=filter_values | fields - filter_field filter_values | stats values(*) as * by prod_issue | fields - prod_issue]&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;The CSV files has a set of filters to apply for each application. It is correctly output-ing these filters to my main search string as follows:&lt;/P&gt;

&lt;P&gt;`NOT ((application=myservice AND field1_prod_issue1=value AND field2_prod_issue1=value)&lt;/P&gt;

&lt;P&gt;OR (application=myservice AND field1_prod_issue2=value AND field2_prod_issue2=value))`&lt;/P&gt;

&lt;P&gt;The problem is I have a ton of filters in the CSV and I don't need them all to be looked up and applied to the search string, I only want the rows that match the correct application to be used.   &lt;/P&gt;

&lt;P&gt;I know that the subsearch runs first, which prevents me from passing values to it from my main search.  Is there a way to achieve this?  I have everything from the NOT, onward, in a macro that I want to append to all my alerts, reports.&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 18:00:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-pass-a-value-to-the-inputlookup-where-inside-a-subsearch/m-p/367317#M108351</guid>
      <dc:creator>AVOLLMER</dc:creator>
      <dc:date>2020-09-29T18:00:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass a value to the |inputlookup where , inside a subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-pass-a-value-to-the-inputlookup-where-inside-a-subsearch/m-p/367318#M108352</link>
      <description>&lt;P&gt;Hi AVOLLMER, &lt;/P&gt;

&lt;P&gt;Try using this &lt;CODE&gt;map&lt;/CODE&gt; command. Refer below link:&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/7.0.2/SearchReference/Map"&gt;http://docs.splunk.com/Documentation/Splunk/7.0.2/SearchReference/Map&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Feb 2018 05:32:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-pass-a-value-to-the-inputlookup-where-inside-a-subsearch/m-p/367318#M108352</guid>
      <dc:creator>p_gurav</dc:creator>
      <dc:date>2018-02-07T05:32:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass a value to the |inputlookup where , inside a subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-pass-a-value-to-the-inputlookup-where-inside-a-subsearch/m-p/367319#M108353</link>
      <description>&lt;P&gt;Thanks for you answer p_gurav , unfortunately, I don't see how I can prepend the results from the map subsearch with the NOT operator to filter the results in my original search as indicated in the questions.&lt;BR /&gt;
If I do this:&lt;BR /&gt;
&lt;CODE&gt;index=examp1 sourcetype=json application=myservice &amp;lt;can't put NOT here since results are on other side of pipe &amp;gt;|map[|inputlookup aps_test_filter.csv where application=$application$| fields application prod_issue filter_field filter_values| eval {filter_field}=filter_values | fields - filter_field filter_values | stats values(*) as * by prod_issue | fields - prod_issue]&lt;/CODE&gt; &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 18:01:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-pass-a-value-to-the-inputlookup-where-inside-a-subsearch/m-p/367319#M108353</guid>
      <dc:creator>AVOLLMER</dc:creator>
      <dc:date>2020-09-29T18:01:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass a value to the |inputlookup where , inside a subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-pass-a-value-to-the-inputlookup-where-inside-a-subsearch/m-p/367320#M108354</link>
      <description>&lt;P&gt;How are you passing application name to your main search?&lt;/P&gt;</description>
      <pubDate>Wed, 07 Feb 2018 19:07:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-pass-a-value-to-the-inputlookup-where-inside-a-subsearch/m-p/367320#M108354</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2018-02-07T19:07:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass a value to the |inputlookup where , inside a subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-pass-a-value-to-the-inputlookup-where-inside-a-subsearch/m-p/367321#M108355</link>
      <description>&lt;P&gt;I want to pass application name from my main search to the subsearch to use it to filter values in the inputlookup and extract the values I want to use to filter the main search.&lt;/P&gt;

&lt;P&gt;My csv files has application, filter_field , filter_values, prod_issue, timestamp, user.  I don't care about the last 2 columns...   my subquery takes those columns and for each prod_issue make a parenthesis set with OR statements between them.. inside the parenthesis is has &lt;CODE&gt;application=myservice AND field1_prod_issue1=value AND field2_prod_issue1=value&lt;/CODE&gt; for each field / value pair that exists per prod_issue, as shown in the example above.  They way I currently have it set up, it works fine, except it pulls all of the for every application...but I only want it to pull the field / value pairs for the application currently being searched for, not EVERY possible combination.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 18:01:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-pass-a-value-to-the-inputlookup-where-inside-a-subsearch/m-p/367321#M108355</guid>
      <dc:creator>AVOLLMER</dc:creator>
      <dc:date>2020-09-29T18:01:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass a value to the |inputlookup where , inside a subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-pass-a-value-to-the-inputlookup-where-inside-a-subsearch/m-p/367322#M108356</link>
      <description>&lt;P&gt;So you want to take all the application from &lt;CODE&gt;index=examp1 sourcetype=json&lt;/CODE&gt; and only apply filters for those apps?&lt;BR /&gt;
If yes, you can do this dirty workaround:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=examp1 sourcetype=json  NOT [|inputlookup aps_test_filter.csv | where [search index=examp1 sourcetype=json | stats count by application | table application]| fields application prod_issue filter_field filter_values| eval {filter_field}=filter_values | fields - filter_field filter_values | stats values(*) as * by prod_issue | fields - prod_issue]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But it may be more in-efficient than having all application filters being applied (subsearch inside subsearch). What's the problem that you see when all application filters are applied? &lt;/P&gt;</description>
      <pubDate>Wed, 07 Feb 2018 20:45:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-pass-a-value-to-the-inputlookup-where-inside-a-subsearch/m-p/367322#M108356</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2018-02-07T20:45:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass a value to the |inputlookup where , inside a subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-pass-a-value-to-the-inputlookup-where-inside-a-subsearch/m-p/367323#M108357</link>
      <description>&lt;P&gt;That work around wouldn't work as any index or sourcetype could be used, and a user might pick an application or 3 applications might result from the rest of whatever they happen to be searching for.  Then I would have to pass the whole search inside.  &lt;/P&gt;

&lt;P&gt;I don't necessarily have a problem with it pulling all of the values out, it works as expected, I just anticipate this lookup to grow really big and it could have a couple hundred AND / OR combinations to filter on if I can't figure out a way to only pull only those filters that are applicable to the applications which result from the main search.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Feb 2018 21:28:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-pass-a-value-to-the-inputlookup-where-inside-a-subsearch/m-p/367323#M108357</guid>
      <dc:creator>AVOLLMER</dc:creator>
      <dc:date>2018-02-07T21:28:54Z</dc:date>
    </item>
  </channel>
</rss>

