<?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 How do I join on a specific field? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-join-on-a-specific-field/m-p/228573#M67615</link>
    <description>&lt;P&gt;I have many events, but only want to select those that have the same &lt;STRONG&gt;docId&lt;/STRONG&gt; in order to compare the Durations of 2 different viewers.&lt;/P&gt;

&lt;P&gt;Sample Data:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Viewer=viewer1, docId=12345, Duration=1204
Viewer=viewer2, docId=12345, Duration=998
Viewer=viewer1, docId=42543, Duration=1411
Viewer=viewer1, docId=98322, Duration=1502
Viewer=viewer2, docId=77777, Duration=1256
....
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Expected Output (only get docId, durations that has been viewed by both viewer1 and viewer2, e.g. docId=12345):&lt;/P&gt;

&lt;P&gt;docId, Viewer1_Duration, Viewer2_Duration&lt;BR /&gt;
12345, 1204, 998&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 07:52:42 GMT</pubDate>
    <dc:creator>slatta</dc:creator>
    <dc:date>2020-09-29T07:52:42Z</dc:date>
    <item>
      <title>How do I join on a specific field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-join-on-a-specific-field/m-p/228573#M67615</link>
      <description>&lt;P&gt;I have many events, but only want to select those that have the same &lt;STRONG&gt;docId&lt;/STRONG&gt; in order to compare the Durations of 2 different viewers.&lt;/P&gt;

&lt;P&gt;Sample Data:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Viewer=viewer1, docId=12345, Duration=1204
Viewer=viewer2, docId=12345, Duration=998
Viewer=viewer1, docId=42543, Duration=1411
Viewer=viewer1, docId=98322, Duration=1502
Viewer=viewer2, docId=77777, Duration=1256
....
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Expected Output (only get docId, durations that has been viewed by both viewer1 and viewer2, e.g. docId=12345):&lt;/P&gt;

&lt;P&gt;docId, Viewer1_Duration, Viewer2_Duration&lt;BR /&gt;
12345, 1204, 998&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 07:52:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-join-on-a-specific-field/m-p/228573#M67615</guid>
      <dc:creator>slatta</dc:creator>
      <dc:date>2020-09-29T07:52:42Z</dc:date>
    </item>
    <item>
      <title>Re: How do I join on a specific field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-join-on-a-specific-field/m-p/228574#M67616</link>
      <description>&lt;P&gt;To join the data, you just need to use a &lt;CODE&gt;join&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;base search&amp;gt; Viewer=viewer1 | join docId [search &amp;lt;base search&amp;gt; Viewer=viewer2]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This should get you the join. If you want the two durations distinguished though, you should &lt;CODE&gt;rename&lt;/CODE&gt; the duration fields to something else before the &lt;CODE&gt;join&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;base search&amp;gt; Viewer=viewer1 | rename Duration AS Viewer1_Duration | join docId [search &amp;lt;base search&amp;gt; Viewer=viewer2 | rename Duration AS Viewer2_Duration ]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope this helps&lt;/P&gt;</description>
      <pubDate>Mon, 16 Nov 2015 20:14:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-join-on-a-specific-field/m-p/228574#M67616</guid>
      <dc:creator>aholzer</dc:creator>
      <dc:date>2015-11-16T20:14:08Z</dc:date>
    </item>
  </channel>
</rss>

