<?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: proper use/function of 'set intersect' in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/proper-use-function-of-set-intersect/m-p/32417#M6743</link>
    <description>&lt;P&gt;thanks!  Much appreciated.&lt;/P&gt;</description>
    <pubDate>Wed, 18 Aug 2010 02:51:54 GMT</pubDate>
    <dc:creator>rgonzale6</dc:creator>
    <dc:date>2010-08-18T02:51:54Z</dc:date>
    <item>
      <title>proper use/function of 'set intersect'</title>
      <link>https://community.splunk.com/t5/Splunk-Search/proper-use-function-of-set-intersect/m-p/32414#M6740</link>
      <description>&lt;P&gt;I have an index where events contain a source IP and a URL destination field.  I would like to construct a query that would show commonality in events.  I would like to search multiple IPs and have my search return only URLs that have been contacted by all of those IPs.  I had constructed my search like so, for only two IPs:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;set intersect [search index=INDEX_NAME Internal_IP=IPPADDR1 | fields URL ] [search index=INDEX_NAME Internal_IP=IPADDR2 | fields URL]|fields URL&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;By my thinking, this would return only the URL fields where there was commonality found between the results of the two subsearches here.  It's not working.&lt;/P&gt;

&lt;P&gt;I can do a subsearch that does this easily enough when it's only two hosts...but in practice, I will need the results for far more than two hosts.  Here's my subsearch-based solution for two hosts, which works well:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;[search index=INDEX_NAME Internal_IP=IPADDR1 | fields URL] index=INDEX_NAME Internal_IP=IPADDR2 | fields URL | top URL&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 18 Aug 2010 02:03:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/proper-use-function-of-set-intersect/m-p/32414#M6740</guid>
      <dc:creator>rgonzale6</dc:creator>
      <dc:date>2010-08-18T02:03:50Z</dc:date>
    </item>
    <item>
      <title>Re: proper use/function of 'set intersect'</title>
      <link>https://community.splunk.com/t5/Splunk-Search/proper-use-function-of-set-intersect/m-p/32415#M6741</link>
      <description>&lt;P&gt;Using &lt;CODE&gt;set&lt;/CODE&gt; isn't going to be the most efficient way to solve this problem.&lt;/P&gt;

&lt;P&gt;I'd use &lt;CODE&gt;stats&lt;/CODE&gt; to look at the source IP characteristics for each url like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=INDEX_NAME | stats values(Internal_IP) as Internal_IPs dc(Internal_IP) as Internal_IP_count by URL
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can then pipe the results of this to &lt;CODE&gt;| search Internal_IP_count &amp;gt; &amp;lt;threshold&amp;gt;&lt;/CODE&gt; to see the URLs that were accessed by more than &lt;CODE&gt;&amp;lt;threshold&amp;gt;&lt;/CODE&gt; IPs as well as the IPs that accessed them.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Aug 2010 02:10:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/proper-use-function-of-set-intersect/m-p/32415#M6741</guid>
      <dc:creator>Stephen_Sorkin</dc:creator>
      <dc:date>2010-08-18T02:10:43Z</dc:date>
    </item>
    <item>
      <title>Re: proper use/function of 'set intersect'</title>
      <link>https://community.splunk.com/t5/Splunk-Search/proper-use-function-of-set-intersect/m-p/32416#M6742</link>
      <description>&lt;P&gt;Just an idea for a different approach:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=INDEX_NAME (Internal_IP=IPADDR1 OR Internal_IP=IPADDR2) | stats dc(Internal_IP) as ip_count by URL | where ip_count&amp;gt;1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;which would reduce the events to those with IPs you're interested in before computing number of distinct ip addresses per url, and then filtering the results to only those that has been accessed by all IPs. It can easily expanded to more IPs: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=INDEX_NAME (Internal_IP=IPADDR1 OR Internal_IP=IPADDR2 OR Internal_IP=IPADDR3) | stats dc(Internal_IP) as ip_count by URL | where ip_count&amp;gt;2
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 18 Aug 2010 02:16:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/proper-use-function-of-set-intersect/m-p/32416#M6742</guid>
      <dc:creator>ziegfried</dc:creator>
      <dc:date>2010-08-18T02:16:14Z</dc:date>
    </item>
    <item>
      <title>Re: proper use/function of 'set intersect'</title>
      <link>https://community.splunk.com/t5/Splunk-Search/proper-use-function-of-set-intersect/m-p/32417#M6743</link>
      <description>&lt;P&gt;thanks!  Much appreciated.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Aug 2010 02:51:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/proper-use-function-of-set-intersect/m-p/32417#M6743</guid>
      <dc:creator>rgonzale6</dc:creator>
      <dc:date>2010-08-18T02:51:54Z</dc:date>
    </item>
    <item>
      <title>Re: proper use/function of 'set intersect'</title>
      <link>https://community.splunk.com/t5/Splunk-Search/proper-use-function-of-set-intersect/m-p/32418#M6744</link>
      <description>&lt;P&gt;thanks!  Appreciate your response.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Aug 2010 02:52:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/proper-use-function-of-set-intersect/m-p/32418#M6744</guid>
      <dc:creator>rgonzale6</dc:creator>
      <dc:date>2010-08-18T02:52:17Z</dc:date>
    </item>
  </channel>
</rss>

