<?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: Given two sourcetypes, how to do you extract data from one sourcetype to another? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Given-two-sourcetypes-how-to-do-you-extract-data-from-one/m-p/211242#M61765</link>
    <description>&lt;P&gt;Try like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=A OR sourcetype=B
| stats values(Type) as Type values(elapsed_time) as elapsed_time by ID
| eval result = IF(Type = "ongoing" OR Type = "finished", elapsed_time, "-")
| table result
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 07 Nov 2016 15:57:33 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2016-11-07T15:57:33Z</dc:date>
    <item>
      <title>Given two sourcetypes, how to do you extract data from one sourcetype to another?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Given-two-sourcetypes-how-to-do-you-extract-data-from-one/m-p/211241#M61764</link>
      <description>&lt;P&gt;Newbie here, would appreciate if anyone can help to answer this little question.&lt;/P&gt;

&lt;P&gt;I have two sourcetypes, A and B.&lt;/P&gt;

&lt;P&gt;A and B contains different types of data, but have a column called 'ID' that allows them to be linked.&lt;/P&gt;

&lt;P&gt;If I want to do something like a lookup from A on B, or to extract a column from B and place it in A based on ID, how do I go about doing so?&lt;/P&gt;

&lt;P&gt;For example, based on the type of a particular job (in sourcetype A), I want to retrieve the duration taken to complete the job (in source type B)&lt;/P&gt;

&lt;P&gt;The idea is to based on the type of A, look for the ID of the job, then do something like a lookup on B based on the ID column, then retrieve the time taken, here's what I've tried.&lt;/P&gt;

&lt;P&gt;sourcetype=A&lt;BR /&gt;
| join type=left ID [search sourcetype=B elasped_time]&lt;BR /&gt;
| eval result = IF(Type = "ongoing" OR Type = "finished", elapsed_time, "-")&lt;BR /&gt;
| table result&lt;/P&gt;

&lt;P&gt;I've tried join type =inner/outer/left, append, selfjoin, but none of them works for me. I tried lookup but I can't do a lookup for sourcetype, can i?&lt;/P&gt;

&lt;P&gt;Can someone give a helping hand?&lt;/P&gt;

&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 11:41:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Given-two-sourcetypes-how-to-do-you-extract-data-from-one/m-p/211241#M61764</guid>
      <dc:creator>zuokun</dc:creator>
      <dc:date>2020-09-29T11:41:16Z</dc:date>
    </item>
    <item>
      <title>Re: Given two sourcetypes, how to do you extract data from one sourcetype to another?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Given-two-sourcetypes-how-to-do-you-extract-data-from-one/m-p/211242#M61765</link>
      <description>&lt;P&gt;Try like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=A OR sourcetype=B
| stats values(Type) as Type values(elapsed_time) as elapsed_time by ID
| eval result = IF(Type = "ongoing" OR Type = "finished", elapsed_time, "-")
| table result
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 07 Nov 2016 15:57:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Given-two-sourcetypes-how-to-do-you-extract-data-from-one/m-p/211242#M61765</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-11-07T15:57:33Z</dc:date>
    </item>
  </channel>
</rss>

