<?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: Using two sourcetypes - lookup in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Using-two-sourcetypes-lookup/m-p/171831#M49257</link>
    <description>&lt;P&gt;In the end I want to calculate different stats by country. To include data from sourcetype B as well, I need the field country for the userids in this sourcetype.&lt;/P&gt;</description>
    <pubDate>Wed, 21 May 2014 08:34:09 GMT</pubDate>
    <dc:creator>HeinzWaescher</dc:creator>
    <dc:date>2014-05-21T08:34:09Z</dc:date>
    <item>
      <title>Using two sourcetypes - lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-two-sourcetypes-lookup/m-p/171827#M49253</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;there are two sourcetypes A &amp;amp; B which I want to use a search. Both them have a field userid.&lt;/P&gt;

&lt;P&gt;Let's say sourcetype A tells us userId=1 is from country=US. In sourcetype B the field country does not exist. Is there a possibility to do a lookup in search time, that the country is added for all events of userid=1 in sourcetype B as well?&lt;/P&gt;

&lt;P&gt;It would be possible to run a search for sourcetype A and create a lookup.csv.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;col1,col2
userid,country
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And use this csv in a next step:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=A OR sourcetype=B | lookup lookup.csv userid OUTPUT country
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But I think there is a better/easier way which I don't know &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;BR Heinz&lt;/P&gt;</description>
      <pubDate>Tue, 20 May 2014 14:02:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-two-sourcetypes-lookup/m-p/171827#M49253</guid>
      <dc:creator>HeinzWaescher</dc:creator>
      <dc:date>2014-05-20T14:02:23Z</dc:date>
    </item>
    <item>
      <title>Re: Using two sourcetypes - lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-two-sourcetypes-lookup/m-p/171828#M49254</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=A OR sourcetype=B | eventstats first(country) as userCountry by userid | eval country=coalesce(country,userCountry) |...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;another option:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=A OR sourcetype=B | streamstats first(country) as country by userid | .....
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 20 May 2014 14:10:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-two-sourcetypes-lookup/m-p/171828#M49254</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-05-20T14:10:05Z</dc:date>
    </item>
    <item>
      <title>Re: Using two sourcetypes - lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-two-sourcetypes-lookup/m-p/171829#M49255</link>
      <description>&lt;P&gt;thanks, this works as well. but in my experience eventstats is veeery slow, so I would like to avoid it if possible&lt;/P&gt;</description>
      <pubDate>Tue, 20 May 2014 14:15:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-two-sourcetypes-lookup/m-p/171829#M49255</guid>
      <dc:creator>HeinzWaescher</dc:creator>
      <dc:date>2014-05-20T14:15:47Z</dc:date>
    </item>
    <item>
      <title>Re: Using two sourcetypes - lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-two-sourcetypes-lookup/m-p/171830#M49256</link>
      <description>&lt;P&gt;There may be a better solution if you could tell what is the ultimate requirement? Sample output or something? (I am sure, you don't just want to see the data in raw format)&lt;/P&gt;</description>
      <pubDate>Tue, 20 May 2014 14:23:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-two-sourcetypes-lookup/m-p/171830#M49256</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-05-20T14:23:04Z</dc:date>
    </item>
    <item>
      <title>Re: Using two sourcetypes - lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-two-sourcetypes-lookup/m-p/171831#M49257</link>
      <description>&lt;P&gt;In the end I want to calculate different stats by country. To include data from sourcetype B as well, I need the field country for the userids in this sourcetype.&lt;/P&gt;</description>
      <pubDate>Wed, 21 May 2014 08:34:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-two-sourcetypes-lookup/m-p/171831#M49257</guid>
      <dc:creator>HeinzWaescher</dc:creator>
      <dc:date>2014-05-21T08:34:09Z</dc:date>
    </item>
  </channel>
</rss>

