<?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: sub-search and destIP foreach srcIP in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/sub-search-and-destIP-foreach-srcIP/m-p/31890#M6626</link>
    <description>&lt;P&gt;Assuming that you have extracted the &lt;CODE&gt;protocol, src_ip, dst_ip&lt;/CODE&gt; and &lt;CODE&gt;dst_port&lt;/CODE&gt; as fields (either through conf files or with &lt;CODE&gt;rex&lt;/CODE&gt;) you can do this by concatenating the destination fields together;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...| eval destination = dst_ip . " " . protocol . " " . dst_port 
| stats values(destination) by src_ip
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The function &lt;CODE&gt;values&lt;/CODE&gt; give the distinct values for a field. If using &lt;CODE&gt;list&lt;/CODE&gt; you get all of them, which may include duplicates.  &lt;/P&gt;

&lt;P&gt;/K&lt;/P&gt;</description>
    <pubDate>Mon, 12 Aug 2013 14:39:21 GMT</pubDate>
    <dc:creator>kristian_kolb</dc:creator>
    <dc:date>2013-08-12T14:39:21Z</dc:date>
    <item>
      <title>sub-search and destIP foreach srcIP</title>
      <link>https://community.splunk.com/t5/Splunk-Search/sub-search-and-destIP-foreach-srcIP/m-p/31888#M6624</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I would like to obtain a complete list of all connection.&lt;/P&gt;

&lt;P&gt;for exemple : &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SRC         | DST         |PORT
a.a.a.a     | z.z.z.z     | tcp 22
            | x.x.x.x     | tcp 8080
b.b.b.b     | x.x.x.x     | tcp 80
...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;For that, I've made two search, one for list all src IP and the second for the dst IP :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="toto.log"
  | rex max_match=100 "\binside:(?&amp;lt;ip&amp;gt;\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\b"
  | stats values(ip) as ip_list


source="toto.log" inside:X.X.X.X
  | rex max_match=100 "\boutside:(?&amp;lt;ip&amp;gt;\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\b"
  | stats values(ip) as ip_list
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But I don't know how do a &lt;A href="http://docs.splunk.com/Documentation/Splunk/5.0.3/Tutorial/Useasubsearch"&gt;sub-search&lt;/A&gt; to have a result like I've explain.&lt;/P&gt;

&lt;P&gt;My log look like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Aug  1 00:00:09 x.x.x.x %FWSM-4-106023: Deny udp src inside:x.x.x.x/50464 dst outside:x.x.x.x/53 by access-group "inside_access_in" [0x0, 0x0]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Can I do what I want ? If yes, how ? And Is it the best way to obtain the result ?&lt;/P&gt;

&lt;P&gt;Thanks for reading.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Aug 2013 12:11:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/sub-search-and-destIP-foreach-srcIP/m-p/31888#M6624</guid>
      <dc:creator>Gilgalidd</dc:creator>
      <dc:date>2013-08-12T12:11:30Z</dc:date>
    </item>
    <item>
      <title>Re: sub-search and destIP foreach srcIP</title>
      <link>https://community.splunk.com/t5/Splunk-Search/sub-search-and-destIP-foreach-srcIP/m-p/31889#M6625</link>
      <description>&lt;P&gt;Create field extractions instead of doing a rex in search. Then you can do a search line this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="toto.log" | stats list(dstip),list(dstport) by srcip
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 12 Aug 2013 13:08:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/sub-search-and-destIP-foreach-srcIP/m-p/31889#M6625</guid>
      <dc:creator>antlefebvre</dc:creator>
      <dc:date>2013-08-12T13:08:05Z</dc:date>
    </item>
    <item>
      <title>Re: sub-search and destIP foreach srcIP</title>
      <link>https://community.splunk.com/t5/Splunk-Search/sub-search-and-destIP-foreach-srcIP/m-p/31890#M6626</link>
      <description>&lt;P&gt;Assuming that you have extracted the &lt;CODE&gt;protocol, src_ip, dst_ip&lt;/CODE&gt; and &lt;CODE&gt;dst_port&lt;/CODE&gt; as fields (either through conf files or with &lt;CODE&gt;rex&lt;/CODE&gt;) you can do this by concatenating the destination fields together;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...| eval destination = dst_ip . " " . protocol . " " . dst_port 
| stats values(destination) by src_ip
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The function &lt;CODE&gt;values&lt;/CODE&gt; give the distinct values for a field. If using &lt;CODE&gt;list&lt;/CODE&gt; you get all of them, which may include duplicates.  &lt;/P&gt;

&lt;P&gt;/K&lt;/P&gt;</description>
      <pubDate>Mon, 12 Aug 2013 14:39:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/sub-search-and-destIP-foreach-srcIP/m-p/31890#M6626</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2013-08-12T14:39:21Z</dc:date>
    </item>
    <item>
      <title>Re: sub-search and destIP foreach srcIP</title>
      <link>https://community.splunk.com/t5/Splunk-Search/sub-search-and-destIP-foreach-srcIP/m-p/31891#M6627</link>
      <description>&lt;P&gt;With this approach, there is no connection between the list of IP's and the list of ports. They will be sorted independently.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Aug 2013 14:40:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/sub-search-and-destIP-foreach-srcIP/m-p/31891#M6627</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2013-08-12T14:40:41Z</dc:date>
    </item>
    <item>
      <title>Re: sub-search and destIP foreach srcIP</title>
      <link>https://community.splunk.com/t5/Splunk-Search/sub-search-and-destIP-foreach-srcIP/m-p/31892#M6628</link>
      <description>&lt;P&gt;Thank you much. I was unaware that list sorted independently.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Aug 2013 15:44:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/sub-search-and-destIP-foreach-srcIP/m-p/31892#M6628</guid>
      <dc:creator>antlefebvre</dc:creator>
      <dc:date>2013-08-12T15:44:07Z</dc:date>
    </item>
    <item>
      <title>Re: sub-search and destIP foreach srcIP</title>
      <link>https://community.splunk.com/t5/Splunk-Search/sub-search-and-destIP-foreach-srcIP/m-p/31893#M6629</link>
      <description>&lt;P&gt;oops, I might have been a bit too quick there. According to docs &lt;CODE&gt;list&lt;/CODE&gt;s will be sorted by the order in which they are returned. However making such a list is just like a &lt;CODE&gt;table&lt;/CODE&gt;. Sorry for my confusing things.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Aug 2013 16:15:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/sub-search-and-destIP-foreach-srcIP/m-p/31893#M6629</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2013-08-12T16:15:46Z</dc:date>
    </item>
    <item>
      <title>Re: sub-search and destIP foreach srcIP</title>
      <link>https://community.splunk.com/t5/Splunk-Search/sub-search-and-destIP-foreach-srcIP/m-p/31894#M6630</link>
      <description>&lt;P&gt;Thanks for your reply, but i don't understand how use this with my log. Can you give me more information to get protocol, port and other fields ?&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2013 08:12:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/sub-search-and-destIP-foreach-srcIP/m-p/31894#M6630</guid>
      <dc:creator>Gilgalidd</dc:creator>
      <dc:date>2013-08-13T08:12:58Z</dc:date>
    </item>
    <item>
      <title>Re: sub-search and destIP foreach srcIP</title>
      <link>https://community.splunk.com/t5/Splunk-Search/sub-search-and-destIP-foreach-srcIP/m-p/31895#M6631</link>
      <description>&lt;P&gt;You'll need to extract the relevant portions of the event into so-called 'fields'. you can do that with &lt;CODE&gt;rex&lt;/CODE&gt; as part of a search query (which you have already done), or put (more or less) the same logic into config files, so that the fields are automatically extracted.&lt;/P&gt;

&lt;P&gt;Start at this page, and follow some of the links to understand how that is performed;&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Tutorial/Usefieldstosearch"&gt;http://docs.splunk.com/Documentation/Splunk/latest/Tutorial/Usefieldstosearch&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2013 08:26:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/sub-search-and-destIP-foreach-srcIP/m-p/31895#M6631</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2013-08-13T08:26:11Z</dc:date>
    </item>
    <item>
      <title>Re: sub-search and destIP foreach srcIP</title>
      <link>https://community.splunk.com/t5/Splunk-Search/sub-search-and-destIP-foreach-srcIP/m-p/31896#M6632</link>
      <description>&lt;P&gt;Thanks a lot for your help !&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="toto.log"
  | rex max_match=100 "\bsrc (?&amp;lt;Sint&amp;gt;\w{1,99}):(?&amp;lt;Sip&amp;gt;\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\/(?&amp;lt;Sport&amp;gt;\d{1,5})\b"
  | rex max_match=100 "\bdst (?&amp;lt;Dint&amp;gt;\w{1,99}):(?&amp;lt;Dip&amp;gt;\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\/(?&amp;lt;Dport&amp;gt;\d{1,5})\b"
  | eval src=Sint .":".Sip."/".Sport 
  | eval dst=Dint .":".Dip."/".Dport
  | stats values(src) by dst
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;give me a nice result&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2013 14:32:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/sub-search-and-destIP-foreach-srcIP/m-p/31896#M6632</guid>
      <dc:creator>Gilgalidd</dc:creator>
      <dc:date>2013-08-13T14:32:04Z</dc:date>
    </item>
  </channel>
</rss>

