<?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 Ignore Field in Embedded Search but include it in Final Table in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Ignore-Field-in-Embedded-Search-but-include-it-in-Final-Table/m-p/325619#M164470</link>
    <description>&lt;P&gt;&lt;STRONG&gt;Scenario:&lt;/STRONG&gt;&lt;BR /&gt;
- The data I need is ultimately contained in completely different indeces/sourcetypes&lt;BR /&gt;
- I have a set of 5 computers and a whitelist of addresses they're supposed to go out to but they're going to others&lt;BR /&gt;
&lt;EM&gt;- Their hostnames are contained in my "ip_to_hostname" sourcetype&lt;BR /&gt;
*- The addressed they request are contained in my "dns_requests" sourcetype&lt;BR /&gt;
- The "dns_requests" sourcetype basically gives the "internal_ip" and "destination_ips"&lt;BR /&gt;
- The "ip_to_hostname" sourcetype has the fields "internal_ip" and "hostname" but does **NOT&lt;/EM&gt;* have the field "destination_ip"&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Problem:&lt;/STRONG&gt;&lt;BR /&gt;
I created an embedded search which first uses "dns_requests" to grab the list of "internal_ip" then passes that to the ultimate search which uses the "ip_to_hostname" sourcetype to resolve the "internal_ip" to the "hostname". The problem is I can't figure out how to make a table which features all 3 needed items making a table of: &lt;STRONG&gt;&lt;EM&gt;internal_ip&lt;/EM&gt;&lt;/STRONG&gt;, &lt;STRONG&gt;&lt;EM&gt;hostname&lt;/EM&gt;&lt;/STRONG&gt;, &lt;STRONG&gt;&lt;EM&gt;destination_ips&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Hypothesis:&lt;/STRONG&gt;&lt;BR /&gt;
I think I'll need to use the "join" or "transaction" commands in some capacity here?&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Search:&lt;/STRONG&gt;&lt;BR /&gt;
sourcetype=ip_to_hostname [search sourcetype=dns_requests AND direction=outbound AND internal_ip=10.1.1.0/24 | dedup internal_ip | table internal_ip] | table internal_ip, hostname | sort - internal_ip&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;FLAWED Search:&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;
sourcetype=ip_to_hostname [search sourcetype=dns_requests AND direction=outbound AND internal_ip=10.1.1.0/24 | dedup internal_ip | table internal_ip, &lt;STRONG&gt;&lt;EM&gt;destination_ips&lt;/EM&gt;&lt;/STRONG&gt;] | table internal_ip, hostname &lt;STRONG&gt;destination_ips&lt;/STRONG&gt; | sort - internal_ip&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 17:07:35 GMT</pubDate>
    <dc:creator>ZellNorman</dc:creator>
    <dc:date>2020-09-29T17:07:35Z</dc:date>
    <item>
      <title>Ignore Field in Embedded Search but include it in Final Table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Ignore-Field-in-Embedded-Search-but-include-it-in-Final-Table/m-p/325619#M164470</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Scenario:&lt;/STRONG&gt;&lt;BR /&gt;
- The data I need is ultimately contained in completely different indeces/sourcetypes&lt;BR /&gt;
- I have a set of 5 computers and a whitelist of addresses they're supposed to go out to but they're going to others&lt;BR /&gt;
&lt;EM&gt;- Their hostnames are contained in my "ip_to_hostname" sourcetype&lt;BR /&gt;
*- The addressed they request are contained in my "dns_requests" sourcetype&lt;BR /&gt;
- The "dns_requests" sourcetype basically gives the "internal_ip" and "destination_ips"&lt;BR /&gt;
- The "ip_to_hostname" sourcetype has the fields "internal_ip" and "hostname" but does **NOT&lt;/EM&gt;* have the field "destination_ip"&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Problem:&lt;/STRONG&gt;&lt;BR /&gt;
I created an embedded search which first uses "dns_requests" to grab the list of "internal_ip" then passes that to the ultimate search which uses the "ip_to_hostname" sourcetype to resolve the "internal_ip" to the "hostname". The problem is I can't figure out how to make a table which features all 3 needed items making a table of: &lt;STRONG&gt;&lt;EM&gt;internal_ip&lt;/EM&gt;&lt;/STRONG&gt;, &lt;STRONG&gt;&lt;EM&gt;hostname&lt;/EM&gt;&lt;/STRONG&gt;, &lt;STRONG&gt;&lt;EM&gt;destination_ips&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Hypothesis:&lt;/STRONG&gt;&lt;BR /&gt;
I think I'll need to use the "join" or "transaction" commands in some capacity here?&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Search:&lt;/STRONG&gt;&lt;BR /&gt;
sourcetype=ip_to_hostname [search sourcetype=dns_requests AND direction=outbound AND internal_ip=10.1.1.0/24 | dedup internal_ip | table internal_ip] | table internal_ip, hostname | sort - internal_ip&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;FLAWED Search:&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;
sourcetype=ip_to_hostname [search sourcetype=dns_requests AND direction=outbound AND internal_ip=10.1.1.0/24 | dedup internal_ip | table internal_ip, &lt;STRONG&gt;&lt;EM&gt;destination_ips&lt;/EM&gt;&lt;/STRONG&gt;] | table internal_ip, hostname &lt;STRONG&gt;destination_ips&lt;/STRONG&gt; | sort - internal_ip&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:07:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Ignore-Field-in-Embedded-Search-but-include-it-in-Final-Table/m-p/325619#M164470</guid>
      <dc:creator>ZellNorman</dc:creator>
      <dc:date>2020-09-29T17:07:35Z</dc:date>
    </item>
    <item>
      <title>Re: Ignore Field in Embedded Search but include it in Final Table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Ignore-Field-in-Embedded-Search-but-include-it-in-Final-Table/m-p/325620#M164471</link>
      <description>&lt;P&gt;Done this. I used join.&lt;/P&gt;

&lt;P&gt;Thanks everyone&lt;/P&gt;</description>
      <pubDate>Fri, 08 Dec 2017 15:43:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Ignore-Field-in-Embedded-Search-but-include-it-in-Final-Table/m-p/325620#M164471</guid>
      <dc:creator>ZellNorman</dc:creator>
      <dc:date>2017-12-08T15:43:10Z</dc:date>
    </item>
    <item>
      <title>Re: Ignore Field in Embedded Search but include it in Final Table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Ignore-Field-in-Embedded-Search-but-include-it-in-Final-Table/m-p/325621#M164472</link>
      <description>&lt;P&gt;@ZellNorman - Please post the solution code as an answer and accept the answer, so people can see how it worked.  Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 08 Dec 2017 18:42:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Ignore-Field-in-Embedded-Search-but-include-it-in-Final-Table/m-p/325621#M164472</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-12-08T18:42:53Z</dc:date>
    </item>
    <item>
      <title>Re: Ignore Field in Embedded Search but include it in Final Table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Ignore-Field-in-Embedded-Search-but-include-it-in-Final-Table/m-p/325622#M164473</link>
      <description>&lt;P&gt;@Daljeanis&lt;BR /&gt;
Sorry about my late reply.&lt;/P&gt;

&lt;P&gt;I actually changed it around again so it's not using join but my solution is contained within a Dashboard where $field1$ is either an internal or external IP address (it can be 10.*) and $field2$ is optional and is usually meant to be  a remote I or, DNS name if you want to specify it in order to see which internal IP visited a specific foreign address or in the absence of $field2$ see a list of internal IPs visited a remote adddress. It replaces remote IP it finds in the 10.0.0.0/8 range with a "-" if they're returned&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;$field1$ $field2$ | rex field=_raw "[\s]*(?$field1$)" | rex field=_raw "[\s]*(?[\d]{1,3}\.[\d]{1,3}\.[\d]{1,3}\.[\d]{1,3})" | rex field=_raw "[\s]*(?[\d]{1,3}\.[\d]{1,3}\.[\d]{1,3}\.[\d]{1,3});" | rex field=_raw "[\s]*(?10\.[\d]{1,3}\.[\d]{1,3}\.[\d]{1,3})" | eval Assoc_Foreign_IPs=if(cidrmatch("10.0.0.0/8",Assoc_Foreign_IPs), "-", Assoc_Foreign_IPs) | stats values(Assoc_Foreign_IPs), values(DNS_Foreign_IPs_End_Semi_Colon) by specified_internal_ip, sourcetype, Assoc_Other_Internal_IPs | sort - values&lt;BR /&gt;
&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jun 2018 12:49:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Ignore-Field-in-Embedded-Search-but-include-it-in-Final-Table/m-p/325622#M164473</guid>
      <dc:creator>ZellNorman</dc:creator>
      <dc:date>2018-06-15T12:49:12Z</dc:date>
    </item>
  </channel>
</rss>

