<?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: Subsearch field groupings in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Subsearch-field-groupings/m-p/254785#M76303</link>
    <description>&lt;P&gt;How about this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=firewall sourcetype=juniper_vgw action=allow ip_proto!=17 rule_id!=263
[search index=firewall sourcetype=vmware:dfw rule_id=6710 NOT UDP
| fields src_ip src_port dst_ip dst_port | format]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;OR &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=firewall sourcetype=juniper_vgw action=allow ip_proto!=17 rule_id!=263
[search index=firewall sourcetype=vmware:dfw rule_id=6710 NOT UDP
| stats count by src_ip src_port dst_ip dst_port | fields - count | format]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 14 Oct 2016 14:48:21 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2016-10-14T14:48:21Z</dc:date>
    <item>
      <title>Subsearch field groupings</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subsearch-field-groupings/m-p/254784#M76302</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I have a search (see below) that Im having a little trouble with.  With it it returns the fields correctly, but its just a lot of ORs (like src_ip=1 OR src_ip=2 OR src_port=1 OR src_port=2).  What Im trying to figure out is, how would I write the query so that the inner search would return the fields in groups to the outer search like (src_ip=1 AND src_port=1 AND dst_ip=1 AND dst_port=1).  Any thoughts?  THANKS!&lt;/P&gt;

&lt;P&gt;index=firewall sourcetype=juniper_vgw action=allow ip_proto!=17 rule_id!=263&lt;BR /&gt;
[search index=firewall sourcetype=vmware:dfw rule_id=6710 NOT UDP&lt;BR /&gt;
| fields src_ip src_port dst_ip dst_port]&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 11:25:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subsearch-field-groupings/m-p/254784#M76302</guid>
      <dc:creator>brywilk_umich</dc:creator>
      <dc:date>2020-09-29T11:25:42Z</dc:date>
    </item>
    <item>
      <title>Re: Subsearch field groupings</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subsearch-field-groupings/m-p/254785#M76303</link>
      <description>&lt;P&gt;How about this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=firewall sourcetype=juniper_vgw action=allow ip_proto!=17 rule_id!=263
[search index=firewall sourcetype=vmware:dfw rule_id=6710 NOT UDP
| fields src_ip src_port dst_ip dst_port | format]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;OR &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=firewall sourcetype=juniper_vgw action=allow ip_proto!=17 rule_id!=263
[search index=firewall sourcetype=vmware:dfw rule_id=6710 NOT UDP
| stats count by src_ip src_port dst_ip dst_port | fields - count | format]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 14 Oct 2016 14:48:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subsearch-field-groupings/m-p/254785#M76303</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-10-14T14:48:21Z</dc:date>
    </item>
    <item>
      <title>Re: Subsearch field groupings</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subsearch-field-groupings/m-p/254786#M76304</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;You can easily test what your subsearch is doing by using the format command.&lt;/P&gt;

&lt;P&gt;For example, in my case I'm simply looking for events that have all the four fields below and then returning the first two I find. Finally pipe it to format to see what would happen if you were using this in a subsearch:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=* src_ip=* src_port=* dest_ip=* dest_port=* 
| head 2
| fields src_ip src_port dest_ip dest_port
| format
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Output:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;( ( dest_ip="10.150.2.155" AND dest_port="53" AND src_ip="10.152.205.27" AND src_port="12345" ) OR ( dest_ip="10.150.2.155" AND dest_port="53" AND src_ip="10.152.205.27" AND src_port="12345" ) ) 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Which basically means: "Fields from event 1 joined with AND" OR "Fields from event 2 joined with AND"&lt;/P&gt;

&lt;P&gt;Let me know if that helps.&lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
J&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;EDIT: didn't notice the answer from somesoni above but that should give you what you are looking for&lt;/STRONG&gt; &lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2016 14:49:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subsearch-field-groupings/m-p/254786#M76304</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2016-10-14T14:49:44Z</dc:date>
    </item>
    <item>
      <title>Re: Subsearch field groupings</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subsearch-field-groupings/m-p/254787#M76305</link>
      <description>&lt;P&gt;The question is a little convoluted.  Could you clarify if you are looking to eval between the two searches or search the "| fields..." for the entire search string?  If it's the latter you can just pull it out of the subsearch.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2016 14:51:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subsearch-field-groupings/m-p/254787#M76305</guid>
      <dc:creator>mgrosholz</dc:creator>
      <dc:date>2016-10-14T14:51:19Z</dc:date>
    </item>
    <item>
      <title>Re: Subsearch field groupings</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subsearch-field-groupings/m-p/254788#M76306</link>
      <description>&lt;P&gt;that worked, thanks a bunch!&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2016 16:02:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subsearch-field-groupings/m-p/254788#M76306</guid>
      <dc:creator>brywilk_umich</dc:creator>
      <dc:date>2016-10-14T16:02:21Z</dc:date>
    </item>
  </channel>
</rss>

