<?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: Utilizing dynamic filter with inputlookup subsearch in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Utilizing-dynamic-filter-with-inputlookup-subsearch/m-p/535260#M151280</link>
    <description>&lt;LI-CODE lang="python"&gt;&amp;lt;search&amp;gt;
| eval data_owner_filter=mvindex(split(data_owner,"_"),1)
| lookup lookup_table.csv dynamic_filter as data_owner_filter fieldx OUTPUTNEW 
| table fieldx, fieldy, data_owner ,rule_type, static_filter
| search as_you_want&lt;/LI-CODE&gt;&lt;P&gt;e.g.&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Lookup" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Lookup&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 09 Jan 2021 12:52:37 GMT</pubDate>
    <dc:creator>to4kawa</dc:creator>
    <dc:date>2021-01-09T12:52:37Z</dc:date>
    <item>
      <title>Utilizing dynamic filter with inputlookup subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Utilizing-dynamic-filter-with-inputlookup-subsearch/m-p/535251#M151277</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am having a situation where a lookup table defines search filters that needs to be used as part of search query. The dynamic filter (data_owner_filter) is built from original search results and subsearch filters are defined by lookup table, where filters can either be inclusive or exclusive.&lt;BR /&gt;&lt;BR /&gt;I have tried with a following kind of approach, but the problem of subsearch not being able to reach value defined as data_owner_filter:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;&amp;lt;search&amp;gt;
| eval data_owner_filter=mvindex(split(data_owner,"_"),1)
| search ([| inputlookup lookup_table.csv | search static_filter="use_case_1" dynamic_filter=data_owner_filter rule_type="inclusive" | fields fieldx])
| search NOT ([| inputlookup lookup_table.csv | search static_filter="use_case_1" dynamic_filter=data_owner_filter rule_type="exclusive" | fields fieldx])
| table fieldx, fieldy, data_owner&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;Example of the lookup table (table can have hundreds of entries):&lt;BR /&gt;static_filter&amp;nbsp; | dynamic_filter | rule_type | fieldx&lt;BR /&gt;use_case_1 |&amp;nbsp;001&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| inclusive&amp;nbsp; | abc*&lt;BR /&gt;use_case_1 |&amp;nbsp;001&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| exclusive | efg*&lt;BR /&gt;use_case_1 |&amp;nbsp;002&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| inclusive&amp;nbsp; | bcd*&lt;BR /&gt;use_case_1 |&amp;nbsp;002&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| inclusive&amp;nbsp; | abc*&lt;BR /&gt;use_case_2 |&amp;nbsp;002&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| inclusive&amp;nbsp; | abc*&lt;BR /&gt;use_case_2 |&amp;nbsp;002&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| exclusive | hij*&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;The idea behind the whole approach is to have a single lookup table to handle various inclusions and exclusions for data related to different data owners (owner defined on data_owner_filter) while having a single search alert configured per use case (defined by "static_filter").&lt;BR /&gt;&lt;BR /&gt;Any suggestion how this could be accomplished?&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jan 2021 20:44:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Utilizing-dynamic-filter-with-inputlookup-subsearch/m-p/535251#M151277</guid>
      <dc:creator>harry1</dc:creator>
      <dc:date>2021-01-08T20:44:52Z</dc:date>
    </item>
    <item>
      <title>Re: Utilizing dynamic filter with inputlookup subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Utilizing-dynamic-filter-with-inputlookup-subsearch/m-p/535260#M151280</link>
      <description>&lt;LI-CODE lang="python"&gt;&amp;lt;search&amp;gt;
| eval data_owner_filter=mvindex(split(data_owner,"_"),1)
| lookup lookup_table.csv dynamic_filter as data_owner_filter fieldx OUTPUTNEW 
| table fieldx, fieldy, data_owner ,rule_type, static_filter
| search as_you_want&lt;/LI-CODE&gt;&lt;P&gt;e.g.&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Lookup" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Lookup&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 09 Jan 2021 12:52:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Utilizing-dynamic-filter-with-inputlookup-subsearch/m-p/535260#M151280</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2021-01-09T12:52:37Z</dc:date>
    </item>
    <item>
      <title>Re: Utilizing dynamic filter with inputlookup subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Utilizing-dynamic-filter-with-inputlookup-subsearch/m-p/535332#M151295</link>
      <description>&lt;P&gt;Thanks. Figured out that it would be doable the way you mentioned, but since the amount of fields from lookup table is changing once in a while and the resulting search being hard to maintain, I decided it is better to split the search into two searches and do the dynamic part of filtering on the second search.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jan 2021 11:03:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Utilizing-dynamic-filter-with-inputlookup-subsearch/m-p/535332#M151295</guid>
      <dc:creator>harry1</dc:creator>
      <dc:date>2021-01-11T11:03:08Z</dc:date>
    </item>
  </channel>
</rss>

