<?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: Join 2 events with same &amp;quot;source&amp;quot; in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Join-2-events-with-same-quot-source-quot/m-p/297234#M89675</link>
    <description>&lt;P&gt;If each file monitored represents a different scan then you can definitely use &lt;CODE&gt;source&lt;/CODE&gt; for transaction.&lt;/P&gt;

&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "scan_(?&amp;lt;network&amp;gt;([0-9]{1,3}\.){3}[0-9]{1,3})_(?&amp;lt;masklen&amp;gt;[0-9]+)_"
| eval subnet=network."/".masklen
| rex "\((?&amp;lt;hosts_up&amp;gt;[0-9]+) hosts up\)"
| transaction startswith=eval(isnotnull(subnet)) endswith=eval(isnotnull(hosts_up)) source
| table _time subnet hosts_up duration
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 09 Jan 2018 03:47:19 GMT</pubDate>
    <dc:creator>micahkemp</dc:creator>
    <dc:date>2018-01-09T03:47:19Z</dc:date>
    <item>
      <title>Join 2 events with same "source"</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-2-events-with-same-quot-source-quot/m-p/297230#M89671</link>
      <description>&lt;P&gt;I want to join the nmap scanning results. The common field is the source "nmapscan_1.gnmap" while other scans will have a different source name.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Event 1&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;# Nmap 5.51 scan initiated Tue Dec 11 10:54:16 2017 as: nmap -A -T4 -oA scan_192.168.1.0_24_20171219 192.168.1.0/24
host =nmapserver   source =nmapscan_1.gnmap   sourcetype =nmap
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Event 2&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;# Nmap done at Tue Dec 11 12:20:04 2017 -- 256 IP addresses (81 hosts up) scanned in 5147.70 seconds
host =nmapserver   source =nmapscan_1.gnmap   sourcetype =nmap
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want to get the following results:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Time, Subnet, #Hosts up, Duration
Tue Dec 11 10:54:16 2017, 192.168.1.0/24, 81, 5147.70
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Could I use the "source" as a common field and how to do this? Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jan 2018 03:50:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-2-events-with-same-quot-source-quot/m-p/297230#M89671</guid>
      <dc:creator>henryyiu2degree</dc:creator>
      <dc:date>2018-01-08T03:50:22Z</dc:date>
    </item>
    <item>
      <title>Re: Join 2 events with same "source"</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-2-events-with-same-quot-source-quot/m-p/297231#M89672</link>
      <description>&lt;P&gt;hey @henryyiu2degrees&lt;/P&gt;

&lt;P&gt;No, you cannot use the &lt;CODE&gt;source&lt;/CODE&gt; as a common field. As in that particular source field, there might be plenty of events so essentially there is nothing common as such in these particular two events.  Also, the &lt;CODE&gt;source&lt;/CODE&gt; is metadata field it is not something that is coming from logs.&lt;BR /&gt;
So if you want to correlate these two events, then you need to have something common in the &lt;CODE&gt;raw&lt;/CODE&gt; logs i.e. &lt;CODE&gt;host_ip&lt;/CODE&gt; OR &lt;CODE&gt;username&lt;/CODE&gt; &lt;CODE&gt;userid&lt;/CODE&gt; which is a unique identifier only for those particular two events.&lt;/P&gt;

&lt;P&gt;I hope this explanation helps you understand these things!&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jan 2018 07:00:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-2-events-with-same-quot-source-quot/m-p/297231#M89672</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2018-01-08T07:00:18Z</dc:date>
    </item>
    <item>
      <title>Re: Join 2 events with same "source"</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-2-events-with-same-quot-source-quot/m-p/297232#M89673</link>
      <description>&lt;P&gt;Thanks @mayurr98 for your comment.&lt;/P&gt;

&lt;P&gt;I afraid there is no common fields in the raw logs but could I join "scan initiated" and the next "Nmap done" together?&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jan 2018 22:54:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-2-events-with-same-quot-source-quot/m-p/297232#M89673</guid>
      <dc:creator>henryyiu2degree</dc:creator>
      <dc:date>2018-01-08T22:54:17Z</dc:date>
    </item>
    <item>
      <title>Re: Join 2 events with same "source"</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-2-events-with-same-quot-source-quot/m-p/297233#M89674</link>
      <description>&lt;P&gt;I don’t think but you can try below search&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=your_index | transaction startswith=“scan initiated” endswith=“Nmap done”
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;After running this search see if like events are getting correlated although it is not recommended to use this command unless you have common field but just check !&lt;/P&gt;

&lt;P&gt;Let me know if this works!&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 03:32:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-2-events-with-same-quot-source-quot/m-p/297233#M89674</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2018-01-09T03:32:38Z</dc:date>
    </item>
    <item>
      <title>Re: Join 2 events with same "source"</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-2-events-with-same-quot-source-quot/m-p/297234#M89675</link>
      <description>&lt;P&gt;If each file monitored represents a different scan then you can definitely use &lt;CODE&gt;source&lt;/CODE&gt; for transaction.&lt;/P&gt;

&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "scan_(?&amp;lt;network&amp;gt;([0-9]{1,3}\.){3}[0-9]{1,3})_(?&amp;lt;masklen&amp;gt;[0-9]+)_"
| eval subnet=network."/".masklen
| rex "\((?&amp;lt;hosts_up&amp;gt;[0-9]+) hosts up\)"
| transaction startswith=eval(isnotnull(subnet)) endswith=eval(isnotnull(hosts_up)) source
| table _time subnet hosts_up duration
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 09 Jan 2018 03:47:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-2-events-with-same-quot-source-quot/m-p/297234#M89675</guid>
      <dc:creator>micahkemp</dc:creator>
      <dc:date>2018-01-09T03:47:19Z</dc:date>
    </item>
    <item>
      <title>Re: Join 2 events with same "source"</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-2-events-with-same-quot-source-quot/m-p/297235#M89676</link>
      <description>&lt;P&gt;Also try this &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=index1  OR index=index2  (source=source1 OR source=source2)
| rex field=_raw "gtid\((?P&amp;lt;trans_id&amp;gt;[^\)]+)"
| stats values(_raw) as raw_event by trans_id
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Let me know what you get&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 03:50:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-2-events-with-same-quot-source-quot/m-p/297235#M89676</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2018-01-09T03:50:09Z</dc:date>
    </item>
    <item>
      <title>Re: Join 2 events with same "source"</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-2-events-with-same-quot-source-quot/m-p/297236#M89677</link>
      <description>&lt;P&gt;This works perfectly, thanks for the help.&lt;/P&gt;

&lt;P&gt;I have changed a little to use the last subnet as that one is generated by nmap:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=_raw ".*scan\sinitiated\s.*\s(?&amp;lt;subnet&amp;gt;\d+.\d+.\d+.\d+\/\d\d)"
| rex field=_raw "\((?&amp;lt;hosts_up&amp;gt;\d+)\shosts\sup\)\sscanned\sin\s(?&amp;lt;duration&amp;gt;\d+).\d\d\sseconds"
| transaction startswith=eval(isnotnull(subnet)) endswith=eval(isnotnull(hosts_up)) source
| table _time, subnet, hosts_up, duration
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 09 Jan 2018 22:15:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-2-events-with-same-quot-source-quot/m-p/297236#M89677</guid>
      <dc:creator>henryyiu2degree</dc:creator>
      <dc:date>2018-01-09T22:15:32Z</dc:date>
    </item>
    <item>
      <title>Re: Join 2 events with same "source"</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-2-events-with-same-quot-source-quot/m-p/297237#M89678</link>
      <description>&lt;P&gt;I have tried this and work as well, but the others answer is more accurate.&lt;BR /&gt;
Appreciate your help, thanks a lot.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 22:22:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-2-events-with-same-quot-source-quot/m-p/297237#M89678</guid>
      <dc:creator>henryyiu2degree</dc:creator>
      <dc:date>2018-01-09T22:22:11Z</dc:date>
    </item>
  </channel>
</rss>

