<?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: Search over two sources and present combined results in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Search-over-two-sources-and-present-combined-results/m-p/124667#M33695</link>
    <description>&lt;P&gt;Hi frank_zhang,&lt;/P&gt;

&lt;P&gt;give this a try:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;base search yielding events from both sources | stats last(Site) AS Site, last(Used) AS Used by IP, MAC, Time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;that should provide what you described in the last comment.&lt;/P&gt;

&lt;P&gt;hope this helps, also take a look at this &lt;A href="http://answers.splunk.com/answers/129424/how-to-compare-fields-over-multiple-sourcetypes-without-join-append-or-use-of-subsearches"&gt;answer&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
    <pubDate>Wed, 09 Apr 2014 05:40:46 GMT</pubDate>
    <dc:creator>MuS</dc:creator>
    <dc:date>2014-04-09T05:40:46Z</dc:date>
    <item>
      <title>Search over two sources and present combined results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-over-two-sources-and-present-combined-results/m-p/124660#M33688</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have the following two sources:&lt;/P&gt;

&lt;P&gt;Source1:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| Time  | IP       | MAC    |
| 08:01 | 10.0.1.1 | MAC1   |
| 08:02 | 10.0.1.2 | MAC2   |
......
| 08:31 | 10.0.1.1 | MAC1-1 |
......
| 09:01 | 10.0.1.1 | MAC1-2 |
| 09:02 | 10.0.1.2 | MAC2   |
| 09:03 | 10.0.1.3 | MAC3   |
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Raw events for this source are generated constantly, and same IP might be associated with different MAC address over time.&lt;/P&gt;

&lt;P&gt;Source2:&lt;BR /&gt;
    | Time  | IP       | Site    | Used   |&lt;BR /&gt;
    | 08:00 | 10.0.1.1 | Site1   | Used   |&lt;BR /&gt;
    | 08:00 | 10.0.1.2 | Site2   | Unused |&lt;BR /&gt;
    ......&lt;BR /&gt;
    | 08:29 | 10.0.1.1 | Site1   | Unused |&lt;BR /&gt;
    | 08:30 | 10.0.1.1 | Site1-1 | Unused |&lt;BR /&gt;
    ......&lt;BR /&gt;
    | 09:00 | 10.0.1.1 | Site1   | Used   |&lt;BR /&gt;
    | 09:00 | 10.0.1.2 | Site2   | Used   |&lt;BR /&gt;
    ......&lt;BR /&gt;
    | 09:10 | 10.0.1.3 | Site3   | Used   |&lt;/P&gt;

&lt;P&gt;Raw events for this source are also generated constantly, and independant from Source1.&lt;/P&gt;

&lt;P&gt;The report I'm trying to build is to search over both sources and present combined results as below:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| Time  | IP       | MAC    | Site    | Used   |
| 08:01 | 10.0.1.1 | MAC1   | Site1   | Used   |
| 08:02 | 10.0.1.2 | MAC2   | Site2   | Unused |
......
| 08:31 | 10.0.1.1 | MAC1-1 | Site1-1 | Unused |
......
| 09:01 | 10.0.1.1 | MAC1-2 | Site1   | Used   |
| 09:02 | 10.0.1.2 | MAC2   | Site2   | Used   |
| 09:03 | 10.0.1.3 | MAC3   | NULL    | NULL   |
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I.e., events from both sources are joined by the IP field, and the "Site" and "Used" values are based on the latest event in Source2 at that time for that specific IP.&lt;/P&gt;

&lt;P&gt;Could anyone please shed some light on how to build such search? I assume I should use the transaction command but haven't figure out how to use it correctly.&lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Apr 2014 18:56:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-over-two-sources-and-present-combined-results/m-p/124660#M33688</guid>
      <dc:creator>frank_zhang</dc:creator>
      <dc:date>2014-04-08T18:56:18Z</dc:date>
    </item>
    <item>
      <title>Re: Search over two sources and present combined results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-over-two-sources-and-present-combined-results/m-p/124661#M33689</link>
      <description>&lt;P&gt;I think it's not enough to join the two sources by IP since the same IP appears at several different times.  A simple &lt;CODE&gt;join&lt;/CODE&gt; should work, however.  You can use a transaction if you have distinct events that start and end each transaction.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Apr 2014 19:25:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-over-two-sources-and-present-combined-results/m-p/124661#M33689</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2014-04-08T19:25:51Z</dc:date>
    </item>
    <item>
      <title>Re: Search over two sources and present combined results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-over-two-sources-and-present-combined-results/m-p/124662#M33690</link>
      <description>&lt;P&gt;Give this a shot:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;base search yielding events from both sources | transaction IP maxspan=5m | table _time IP MAC Site Used
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I've assumed that an IP will not be reused within five minutes, change the span if a shorter reuse cycle is possible. Make sure the field names are exactly as they exist in your sources.&lt;/P&gt;

&lt;P&gt;Using transaction allows for small time differences as shown in your first example, 08:01 in source1 and 08:00 in source2 - joining by IP and Time would fail here.&lt;BR /&gt;
Joining by IP only would fail because of the IP reuse.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Apr 2014 20:30:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-over-two-sources-and-present-combined-results/m-p/124662#M33690</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-04-08T20:30:14Z</dc:date>
    </item>
    <item>
      <title>Re: Search over two sources and present combined results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-over-two-sources-and-present-combined-results/m-p/124663#M33691</link>
      <description>&lt;P&gt;Thanks for the post. My comments are too long so I'm going to split it:&lt;/P&gt;

&lt;P&gt;I didn't realize the time span could be a factor, so the sample events I came up was over simplified.&lt;/P&gt;

&lt;P&gt;An IP is likely to be reused within 5 minutes, Source1 is actually DHCP lease events, so there might be a request event immediately followed by an issue event.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Apr 2014 22:47:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-over-two-sources-and-present-combined-results/m-p/124663#M33691</guid>
      <dc:creator>frank_zhang</dc:creator>
      <dc:date>2014-04-08T22:47:00Z</dc:date>
    </item>
    <item>
      <title>Re: Search over two sources and present combined results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-over-two-sources-and-present-combined-results/m-p/124664#M33692</link>
      <description>&lt;P&gt;However for the purposes of this report, we don't care if the lease is assigned to a different MAC address, so it's okay to display two final events with same IP/Site/Used but different MAC. Given this I guess IP recycle is not a concern. Please let me know if it may cause other issues that I'm not aware of.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Apr 2014 22:47:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-over-two-sources-and-present-combined-results/m-p/124664#M33692</guid>
      <dc:creator>frank_zhang</dc:creator>
      <dc:date>2014-04-08T22:47:08Z</dc:date>
    </item>
    <item>
      <title>Re: Search over two sources and present combined results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-over-two-sources-and-present-combined-results/m-p/124665#M33693</link>
      <description>&lt;P&gt;Regarding maxspan=5m, chances are I may end up events like below:&lt;BR /&gt;
Source1:&lt;BR /&gt;
    | Time  | IP       | MAC    |&lt;BR /&gt;
    | 08:01 | 10.0.1.1 | MAC1   |&lt;BR /&gt;
    | 08:05 | 10.0.1.1 | MAC1-1 |&lt;BR /&gt;
Source2:&lt;BR /&gt;
    | Time  | IP       | Site  | Used |&lt;BR /&gt;
    | 01:00 | 10.0.1.1 | Site1 | Used | &amp;lt;-- 1st occurence for IP 10.0.1.1&lt;/P&gt;

&lt;P&gt;I.e., the latest event in Source2 for an IP was generated far before the event in Source1, and we still need to have them joined together as below:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| Time  | IP       | MAC    | Site  | Used |
| 08:01 | 10.0.1.1 | MAC1   | Site1 | Used |
| 08:05 | 10.0.1.1 | MAC1-1 | Site1 | Used |
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 08 Apr 2014 22:48:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-over-two-sources-and-present-combined-results/m-p/124665#M33693</guid>
      <dc:creator>frank_zhang</dc:creator>
      <dc:date>2014-04-08T22:48:08Z</dc:date>
    </item>
    <item>
      <title>Re: Search over two sources and present combined results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-over-two-sources-and-present-combined-results/m-p/124666#M33694</link>
      <description>&lt;P&gt;Basically what I wanted to show with this report is "IP and MAC address with the &lt;EM&gt;latest&lt;/EM&gt; known Site and Used status."&lt;/P&gt;

&lt;P&gt;I'm thinking that I may specify "maxspan=-1" but that could result in an IP address joined with all previous Site/Used rather than the "latest". Probably in the subsearch I should do " | stats latest(*) by IP".&lt;/P&gt;

&lt;P&gt;Do you think it's a viable solution? Is there any performance concern for using "maxspan=-1"?&lt;/P&gt;

&lt;P&gt;Thanks again and I'm going to try your suggestions.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Apr 2014 22:48:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-over-two-sources-and-present-combined-results/m-p/124666#M33694</guid>
      <dc:creator>frank_zhang</dc:creator>
      <dc:date>2014-04-08T22:48:25Z</dc:date>
    </item>
    <item>
      <title>Re: Search over two sources and present combined results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-over-two-sources-and-present-combined-results/m-p/124667#M33695</link>
      <description>&lt;P&gt;Hi frank_zhang,&lt;/P&gt;

&lt;P&gt;give this a try:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;base search yielding events from both sources | stats last(Site) AS Site, last(Used) AS Used by IP, MAC, Time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;that should provide what you described in the last comment.&lt;/P&gt;

&lt;P&gt;hope this helps, also take a look at this &lt;A href="http://answers.splunk.com/answers/129424/how-to-compare-fields-over-multiple-sourcetypes-without-join-append-or-use-of-subsearches"&gt;answer&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Wed, 09 Apr 2014 05:40:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-over-two-sources-and-present-combined-results/m-p/124667#M33695</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2014-04-09T05:40:46Z</dc:date>
    </item>
    <item>
      <title>Re: Search over two sources and present combined results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-over-two-sources-and-present-combined-results/m-p/124668#M33696</link>
      <description>&lt;P&gt;I don't think grouping by &lt;CODE&gt;Time&lt;/CODE&gt; is appropriate - imagine the most recent source2 event for an &lt;CODE&gt;IP&lt;/CODE&gt;/&lt;CODE&gt;MAC&lt;/CODE&gt; combo happened in the previous unit of time, then there is no &lt;CODE&gt;last(Used)&lt;/CODE&gt; for that combination of &lt;CODE&gt;group by&lt;/CODE&gt;-fields.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Apr 2014 08:00:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-over-two-sources-and-present-combined-results/m-p/124668#M33696</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-04-09T08:00:41Z</dc:date>
    </item>
    <item>
      <title>Re: Search over two sources and present combined results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-over-two-sources-and-present-combined-results/m-p/124669#M33697</link>
      <description>&lt;P&gt;To get the latest &lt;CODE&gt;Site&lt;/CODE&gt;/&lt;CODE&gt;Used&lt;/CODE&gt; value for every &lt;CODE&gt;IP&lt;/CODE&gt;/&lt;CODE&gt;MAC&lt;/CODE&gt; combo you can almost use @MuS' query, with only small changes:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;base search yielding events from both sources | stats latest(Time) as latestTime latest(Site) AS latestSite, latest(Used) AS latestUsed by IP, MAC
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;That'll give you a table with those five columns, and one row for every &lt;CODE&gt;IP&lt;/CODE&gt;/&lt;CODE&gt;MAC&lt;/CODE&gt; combo in the time range. The source1 events at 08:02 and 09:02 from your first example would be bunched together into one event at 09:02 using the latest values for &lt;CODE&gt;Used&lt;/CODE&gt; and &lt;CODE&gt;Site&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Apr 2014 08:05:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-over-two-sources-and-present-combined-results/m-p/124669#M33697</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-04-09T08:05:50Z</dc:date>
    </item>
    <item>
      <title>Re: Search over two sources and present combined results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-over-two-sources-and-present-combined-results/m-p/124670#M33698</link>
      <description>&lt;P&gt;That's true, this was an &lt;CODE&gt;early&lt;/CODE&gt; morning answer and I did not consider all possibilities. In this case, it would be better to use something like this:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;base search yielding events from both sources | stats last(Time) AS Time, last(Site) AS Site, last(Used) AS Used by IP, MAC&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Apr 2014 08:07:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-over-two-sources-and-present-combined-results/m-p/124670#M33698</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2014-04-09T08:07:20Z</dc:date>
    </item>
    <item>
      <title>Re: Search over two sources and present combined results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-over-two-sources-and-present-combined-results/m-p/124671#M33699</link>
      <description>&lt;P&gt;...now that I look at it again, the two &lt;CODE&gt;stats by IP MAC&lt;/CODE&gt; queries won't work at all because source2 doesn't have the &lt;CODE&gt;MAC&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Apr 2014 08:07:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-over-two-sources-and-present-combined-results/m-p/124671#M33699</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-04-09T08:07:22Z</dc:date>
    </item>
    <item>
      <title>Re: Search over two sources and present combined results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-over-two-sources-and-present-combined-results/m-p/124672#M33700</link>
      <description>&lt;P&gt;Yeah... see above, grouping by &lt;CODE&gt;MAC&lt;/CODE&gt; that easily won't work either &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Apr 2014 08:08:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-over-two-sources-and-present-combined-results/m-p/124672#M33700</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-04-09T08:08:30Z</dc:date>
    </item>
    <item>
      <title>Re: Search over two sources and present combined results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-over-two-sources-and-present-combined-results/m-p/124673#M33701</link>
      <description>&lt;P&gt;If you have a reasonably small set of data you can sort it by time in ascending order, and copy over the latest seen value of &lt;CODE&gt;Used&lt;/CODE&gt; and &lt;CODE&gt;Seen&lt;/CODE&gt; to the source1 events using &lt;CODE&gt;streamstats&lt;/CODE&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;base blah blah | sort + _time | streamstats latest(Used) as Used latest(Site) as Site by IP | search source=Source1 | table Time IP MAC Site Used
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;That may not be feasible for large data sets though.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Apr 2014 08:10:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-over-two-sources-and-present-combined-results/m-p/124673#M33701</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-04-09T08:10:55Z</dc:date>
    </item>
    <item>
      <title>Re: Search over two sources and present combined results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-over-two-sources-and-present-combined-results/m-p/124674#M33702</link>
      <description>&lt;P&gt;arrrgghhhllll ...... Ich spendier 'ne Runde Flens für die Lösung ohne &lt;CODE&gt;transaction&lt;/CODE&gt; | &lt;CODE&gt;join&lt;/CODE&gt; | &lt;CODE&gt;append&lt;/CODE&gt; &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt; &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Apr 2014 08:16:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-over-two-sources-and-present-combined-results/m-p/124674#M33702</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2014-04-09T08:16:42Z</dc:date>
    </item>
    <item>
      <title>Re: Search over two sources and present combined results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-over-two-sources-and-present-combined-results/m-p/124675#M33703</link>
      <description>&lt;P&gt;Zählt &lt;CODE&gt;sort|streamstats&lt;/CODE&gt;? Falls ja, komm' zur Kieler Woche und ich lass mir gerne einen ausgeben... &lt;A href="http://www.consist.de/comply&amp;amp;secure2014"&gt;http://www.consist.de/comply&amp;amp;secure2014&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Apr 2014 08:19:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-over-two-sources-and-present-combined-results/m-p/124675#M33703</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-04-09T08:19:09Z</dc:date>
    </item>
    <item>
      <title>Re: Search over two sources and present combined results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-over-two-sources-and-present-combined-results/m-p/124676#M33704</link>
      <description>&lt;P&gt;Kieler Woche wird nichts, eventuell bin ich im Herbst in der Nähe von Flensburg. Würde mich dann melden &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Apr 2014 08:34:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-over-two-sources-and-present-combined-results/m-p/124676#M33704</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2014-04-09T08:34:09Z</dc:date>
    </item>
    <item>
      <title>Re: Search over two sources and present combined results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-over-two-sources-and-present-combined-results/m-p/124677#M33705</link>
      <description>&lt;P&gt;Hmm... SplunkLive Hamburg im Mai?&lt;/P&gt;</description>
      <pubDate>Wed, 09 Apr 2014 09:52:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-over-two-sources-and-present-combined-results/m-p/124677#M33705</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-04-09T09:52:36Z</dc:date>
    </item>
  </channel>
</rss>

