<?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 to add fields from subsearch ? Used Join but didnt work ... in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-fields-from-subsearch-Used-Join-but-didnt-work/m-p/184746#M53224</link>
    <description>&lt;P&gt;I have a subsearch which returns a table with 2 columns 'input' and 'Time'. Table from subsearch looks like this. &lt;BR /&gt;
input     ----------------   Time &lt;BR /&gt;
Movie1 ----------------       2&lt;BR /&gt;
Movie2 ----------------       2&lt;BR /&gt;
Movie3 ----------------       2&lt;/P&gt;

&lt;P&gt;Now i would like to return input and Time fields to my main search. As shown below, i'm using join to return input and Time, but it doesn't show any results. I would like to know if im doing anything wrong here ? or is there any better approach to get this done. &lt;/P&gt;

&lt;P&gt;index=&lt;EM&gt;cas&lt;/EM&gt; OR index=&lt;EM&gt;vod&lt;/EM&gt; (sourcetype=ch AND input=&lt;EM&gt;) OR (sourcetype=ac AND id=&lt;/EM&gt; AND code=&lt;EM&gt;) OR (sourcetype=hy AND ruid=&lt;/EM&gt;)| join ,input, TimeInHours [search sourcetype=ch input=* | chart latest(Status) as stat earliest(_time) as earliest by input| eval Time=round(((now()-earliest)/60)/60) | where match(stat, "Failed") | table input,Time]&lt;/P&gt;

&lt;P&gt;Thanks&lt;BR /&gt;
Sheshank&lt;/P&gt;</description>
    <pubDate>Thu, 12 Mar 2015 17:39:49 GMT</pubDate>
    <dc:creator>kshanky143</dc:creator>
    <dc:date>2015-03-12T17:39:49Z</dc:date>
    <item>
      <title>How to add fields from subsearch ? Used Join but didnt work ...</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-fields-from-subsearch-Used-Join-but-didnt-work/m-p/184746#M53224</link>
      <description>&lt;P&gt;I have a subsearch which returns a table with 2 columns 'input' and 'Time'. Table from subsearch looks like this. &lt;BR /&gt;
input     ----------------   Time &lt;BR /&gt;
Movie1 ----------------       2&lt;BR /&gt;
Movie2 ----------------       2&lt;BR /&gt;
Movie3 ----------------       2&lt;/P&gt;

&lt;P&gt;Now i would like to return input and Time fields to my main search. As shown below, i'm using join to return input and Time, but it doesn't show any results. I would like to know if im doing anything wrong here ? or is there any better approach to get this done. &lt;/P&gt;

&lt;P&gt;index=&lt;EM&gt;cas&lt;/EM&gt; OR index=&lt;EM&gt;vod&lt;/EM&gt; (sourcetype=ch AND input=&lt;EM&gt;) OR (sourcetype=ac AND id=&lt;/EM&gt; AND code=&lt;EM&gt;) OR (sourcetype=hy AND ruid=&lt;/EM&gt;)| join ,input, TimeInHours [search sourcetype=ch input=* | chart latest(Status) as stat earliest(_time) as earliest by input| eval Time=round(((now()-earliest)/60)/60) | where match(stat, "Failed") | table input,Time]&lt;/P&gt;

&lt;P&gt;Thanks&lt;BR /&gt;
Sheshank&lt;/P&gt;</description>
      <pubDate>Thu, 12 Mar 2015 17:39:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-fields-from-subsearch-Used-Join-but-didnt-work/m-p/184746#M53224</guid>
      <dc:creator>kshanky143</dc:creator>
      <dc:date>2015-03-12T17:39:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to add fields from subsearch ? Used Join but didnt work ...</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-fields-from-subsearch-Used-Join-but-didnt-work/m-p/184747#M53225</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;What's the common field? I can see that common field TimeInHours is not available in the table result.&lt;/P&gt;

&lt;P&gt;index=cas OR index=vod (sourcetype=ch AND input=) OR (sourcetype=ac AND id= AND code=) OR (sourcetype=hy AND ruid=)| join ,&lt;STRONG&gt;input, TimeInHours&lt;/STRONG&gt; [search sourcetype=ch input=* | chart latest(Status) as stat earliest(_time) as earliest by input| eval Time=round(((now()-earliest)/60)/60) | where match(stat, "Failed") | table &lt;STRONG&gt;input,Time&lt;/STRONG&gt;]&lt;/P&gt;

&lt;P&gt;Assuming input is the only common field in both the searches, &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=cas OR index=vod (sourcetype=ch AND input=) OR (sourcetype=ac AND id= AND code=) OR (sourcetype=hy AND ruid=)| join input, TimeInHours [search sourcetype=ch input=* | chart latest(Status) as stat earliest(_time) as earliest by input| eval Time=round(((now()-earliest)/60)/60) | where match(stat, "Failed") | table input,Time]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;execute the searches and check it manually input has common values,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Search 1: 
     index=cas OR index=vod (sourcetype=ch AND input=) OR (sourcetype=ac AND id= AND code=) OR (sourcetype=hy AND ruid=) | table input

Search 2:
sourcetype=ch input=* | chart latest(Status) as stat earliest(_time) as earliest by input| eval Time=round(((now()-earliest)/60)/60) | where match(stat, "Failed") | table input,Time
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 12 Mar 2015 17:58:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-fields-from-subsearch-Used-Join-but-didnt-work/m-p/184747#M53225</guid>
      <dc:creator>vasanthmss</dc:creator>
      <dc:date>2015-03-12T17:58:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to add fields from subsearch ? Used Join but didnt work ...</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-fields-from-subsearch-Used-Join-but-didnt-work/m-p/184748#M53226</link>
      <description>&lt;P&gt;Hi &lt;/P&gt;

&lt;P&gt;I dont have Time field at all to join. Thats what i have just realized now. Your answer makes more sense now. &lt;BR /&gt;
Thanks. &lt;/P&gt;</description>
      <pubDate>Thu, 12 Mar 2015 18:18:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-fields-from-subsearch-Used-Join-but-didnt-work/m-p/184748#M53226</guid>
      <dc:creator>kshanky143</dc:creator>
      <dc:date>2015-03-12T18:18:34Z</dc:date>
    </item>
  </channel>
</rss>

