<?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: Matching specific fields in main search with the results from subsearch in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Matching-specific-fields-in-main-search-with-the-results-from/m-p/163443#M46394</link>
    <description>&lt;P&gt;I am not &lt;EM&gt;sure&lt;/EM&gt; that this will be better, but try it:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=FW [ search index=ABC 
      | dedup IP | eval src_ip=IP | eval dest_ip=IP | fields src_ip dest_ip
      | format "(" "(" "OR" ")" "OR" ")" ]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You don't really need all the parentheses in the &lt;CODE&gt;format&lt;/CODE&gt; command, but it was hard to read when I substituted spaces instead. And the end result will be the same.&lt;/P&gt;

&lt;P&gt;It is only one subsearch instead of two, and it will specify the fields to search.&lt;/P&gt;</description>
    <pubDate>Tue, 03 Dec 2013 06:28:47 GMT</pubDate>
    <dc:creator>lguinn2</dc:creator>
    <dc:date>2013-12-03T06:28:47Z</dc:date>
    <item>
      <title>Matching specific fields in main search with the results from subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Matching-specific-fields-in-main-search-with-the-results-from/m-p/163440#M46391</link>
      <description>&lt;P&gt;I am monitoring a directory with multiple CSV files and indexing these to say an index "ABC". The goal is to extract a field "IP" from this index and match it against multiple fields (src_ip, dst_ip) in different sourcetypes which will be the main search.&lt;/P&gt;

&lt;P&gt;I am using the following query:&lt;/P&gt;

&lt;P&gt;sourcetype=FW [search index=ABC| rename IP as search | fields search |format]&lt;/P&gt;

&lt;P&gt;This query returns events from sourcetype=FW where any field matches "IP" and it's slow. I would like to search the "IP" only in src_ip and dst_ip fields in the FW. &lt;/P&gt;

&lt;P&gt;How can I achieve this? Is subsearch the right solution in this case, because the list of "IP" in index "ABC" is going to get longer everyday?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 15:24:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Matching-specific-fields-in-main-search-with-the-results-from/m-p/163440#M46391</guid>
      <dc:creator>spj2</dc:creator>
      <dc:date>2020-09-28T15:24:16Z</dc:date>
    </item>
    <item>
      <title>Re: Matching specific fields in main search with the results from subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Matching-specific-fields-in-main-search-with-the-results-from/m-p/163441#M46392</link>
      <description>&lt;P&gt;What is in the CSV files? Do they contain time-stamped events, or are they more like lists or tables of IP addresses?&lt;/P&gt;</description>
      <pubDate>Tue, 03 Dec 2013 06:19:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Matching-specific-fields-in-main-search-with-the-results-from/m-p/163441#M46392</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2013-12-03T06:19:14Z</dc:date>
    </item>
    <item>
      <title>Re: Matching specific fields in main search with the results from subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Matching-specific-fields-in-main-search-with-the-results-from/m-p/163442#M46393</link>
      <description>&lt;P&gt;Try This&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=FW [search index=ABC | stats count by IP | rename IP as src_ip | fields - count] OR [search index=ABC | stats count by IP | rename IP as dst_ip | fields - count]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will take unique values of IP from index=ABC (stats is the fastest way) then using subsearch a clause will be added as filter "src_ip=&lt;VALUES found="" from="" index="ABC"&gt;". Same is repeated for dst_ip, added as OR clause.&lt;/VALUES&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 15:24:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Matching-specific-fields-in-main-search-with-the-results-from/m-p/163442#M46393</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2020-09-28T15:24:27Z</dc:date>
    </item>
    <item>
      <title>Re: Matching specific fields in main search with the results from subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Matching-specific-fields-in-main-search-with-the-results-from/m-p/163443#M46394</link>
      <description>&lt;P&gt;I am not &lt;EM&gt;sure&lt;/EM&gt; that this will be better, but try it:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=FW [ search index=ABC 
      | dedup IP | eval src_ip=IP | eval dest_ip=IP | fields src_ip dest_ip
      | format "(" "(" "OR" ")" "OR" ")" ]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You don't really need all the parentheses in the &lt;CODE&gt;format&lt;/CODE&gt; command, but it was hard to read when I substituted spaces instead. And the end result will be the same.&lt;/P&gt;

&lt;P&gt;It is only one subsearch instead of two, and it will specify the fields to search.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Dec 2013 06:28:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Matching-specific-fields-in-main-search-with-the-results-from/m-p/163443#M46394</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2013-12-03T06:28:47Z</dc:date>
    </item>
    <item>
      <title>Re: Matching specific fields in main search with the results from subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Matching-specific-fields-in-main-search-with-the-results-from/m-p/163444#M46395</link>
      <description>&lt;P&gt;Thanks somesoni2 and lguinn. Both the solutions worked and took exactly the same amount of time.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Dec 2013 14:31:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Matching-specific-fields-in-main-search-with-the-results-from/m-p/163444#M46395</guid>
      <dc:creator>spj2</dc:creator>
      <dc:date>2013-12-03T14:31:13Z</dc:date>
    </item>
  </channel>
</rss>

