<?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 Join a search by field across indexes in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Join-a-search-by-field-across-indexes/m-p/407241#M190929</link>
    <description>&lt;P&gt;I have two different indexes, with the common field being username. &lt;/P&gt;

&lt;P&gt;One index that contains phishing history data. index="phish"&lt;BR /&gt;
One index that contains a list of usernames. index="poorpass"&lt;/P&gt;

&lt;P&gt;I'd like to join both indexes, and match them by username. So I'll have a list of users that are in both indexes. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="phish" status="Clicked Link" 
| eval username=email 
| rex field=username mode=sed "s/@\S+//g" 
| join host 
    [search index="poorpass" group="username"]
| table username
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;My search goes through with no errors, but no events are returned. &lt;/P&gt;</description>
    <pubDate>Thu, 25 Jul 2019 21:05:11 GMT</pubDate>
    <dc:creator>aarichow</dc:creator>
    <dc:date>2019-07-25T21:05:11Z</dc:date>
    <item>
      <title>Join a search by field across indexes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-a-search-by-field-across-indexes/m-p/407241#M190929</link>
      <description>&lt;P&gt;I have two different indexes, with the common field being username. &lt;/P&gt;

&lt;P&gt;One index that contains phishing history data. index="phish"&lt;BR /&gt;
One index that contains a list of usernames. index="poorpass"&lt;/P&gt;

&lt;P&gt;I'd like to join both indexes, and match them by username. So I'll have a list of users that are in both indexes. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="phish" status="Clicked Link" 
| eval username=email 
| rex field=username mode=sed "s/@\S+//g" 
| join host 
    [search index="poorpass" group="username"]
| table username
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;My search goes through with no errors, but no events are returned. &lt;/P&gt;</description>
      <pubDate>Thu, 25 Jul 2019 21:05:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-a-search-by-field-across-indexes/m-p/407241#M190929</guid>
      <dc:creator>aarichow</dc:creator>
      <dc:date>2019-07-25T21:05:11Z</dc:date>
    </item>
    <item>
      <title>Re: Join a search by field across indexes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-a-search-by-field-across-indexes/m-p/407242#M190930</link>
      <description>&lt;P&gt;To clarify, the reason I'm creating the field called username is because it's not an existing field in my index. There is a field in the index, phish, called email, which is the same as username in this case, so I just strip the email at the @ sign, giving me the username. &lt;/P&gt;

&lt;P&gt;I'm then trying to match this field to a existing field in the index poorpass.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jul 2019 21:07:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-a-search-by-field-across-indexes/m-p/407242#M190930</guid>
      <dc:creator>aarichow</dc:creator>
      <dc:date>2019-07-25T21:07:55Z</dc:date>
    </item>
    <item>
      <title>Re: Join a search by field across indexes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-a-search-by-field-across-indexes/m-p/407243#M190931</link>
      <description>&lt;P&gt;HI aarichow,&lt;/P&gt;

&lt;P&gt;give this a try:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;( index="phish" status="Clicked Link" ) OR ( index="poorpass" group="username" )
| rex field=email mode=sed "s/@\S+//g" 
| eval username=case(isnotnull(email), email, isnotnull(username), username, 1=1, "unknown")
| stats values(*) AS * by username, _time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The &lt;CODE&gt;eval&lt;/CODE&gt; will use either email, username, or if neither is available fill the value as &lt;CODE&gt;unknown&lt;/CODE&gt; &lt;/P&gt;

&lt;P&gt;Hope this helps ...&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jul 2019 22:15:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-a-search-by-field-across-indexes/m-p/407243#M190931</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2019-07-25T22:15:35Z</dc:date>
    </item>
    <item>
      <title>Re: Join a search by field across indexes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-a-search-by-field-across-indexes/m-p/407244#M190932</link>
      <description>&lt;P&gt;I ran the search, this just returns all the users that have the status="clicked link", it doesn't match it to the field in poorpass. &lt;/P&gt;</description>
      <pubDate>Fri, 26 Jul 2019 13:35:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-a-search-by-field-across-indexes/m-p/407244#M190932</guid>
      <dc:creator>aarichow</dc:creator>
      <dc:date>2019-07-26T13:35:25Z</dc:date>
    </item>
    <item>
      <title>Re: Join a search by field across indexes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-a-search-by-field-across-indexes/m-p/407245#M190933</link>
      <description>&lt;P&gt;Can you please provide at least two anonymised events for each criteria? Thanks&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jul 2019 02:02:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-a-search-by-field-across-indexes/m-p/407245#M190933</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2019-07-29T02:02:13Z</dc:date>
    </item>
    <item>
      <title>Re: Join a search by field across indexes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-a-search-by-field-across-indexes/m-p/407246#M190934</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(index="phish" status="Clicked Link") OR (index="poorpass" group="username")
| eval username=if(index="phish", email, null())
| rex field=username mode=sed "s/@\S+//g" 
| stats values(*) AS * BY host
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 29 Jul 2019 06:19:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-a-search-by-field-across-indexes/m-p/407246#M190934</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-07-29T06:19:27Z</dc:date>
    </item>
  </channel>
</rss>

