<?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: How to combine Multiple joins with subsearch? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-Multiple-joins-with-subsearch/m-p/496123#M138274</link>
    <description>&lt;P&gt;The key thing is to avoid &lt;EM&gt;BOTH&lt;/EM&gt; &lt;CODE&gt;join&lt;/CODE&gt; and &lt;CODE&gt;subsearch&lt;/CODE&gt;, which is generally possible, like I did here.&lt;/P&gt;</description>
    <pubDate>Wed, 11 Dec 2019 17:27:07 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2019-12-11T17:27:07Z</dc:date>
    <item>
      <title>How to combine Multiple joins with subsearch?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-Multiple-joins-with-subsearch/m-p/496117#M138268</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;

&lt;P&gt;I have 3 joins with subsearch ,how can I combine those 3 joins and make as one join?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;join new1 max=0 [search index=abc Source=WeeklyData earliest=@d+07h+30m latest=@d+14h+30m |rename xy AS new1, ExtraInfo AS "cd"]|rename new1 AS new2
|join new2 max=0 [search index=abc Source=WeeklyData earliest=@d+14h+30m latest=@d+16h+30m |rename xy AS new2, ExtraInfo AS "ef"]|rename new2 AS new3
| join new3 max=0 [search index=abc Source=WeeklyData earliest=-1d@d+16h+30m latest=@d+16h+30m |rename CurrentMouseName AS new3, _time AS "newtime", ExtraInfo AS "newinfo"]|table new3 oldInfo3 newinfo newtime
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Dec 2019 09:34:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-Multiple-joins-with-subsearch/m-p/496117#M138268</guid>
      <dc:creator>ravikanthbadugu</dc:creator>
      <dc:date>2019-12-03T09:34:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine Multiple joins with subsearch?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-Multiple-joins-with-subsearch/m-p/496118#M138269</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;index=abc Source=WeeklyData earliest=-1d@d+16h+30m latest=@d+16h+30m
| eval label=case(relative_time(_time,"@d+07h+30m") &amp;lt;= _time OR _time &amp;lt; relative_time(_time,"@d+14h+30m"),"first"
,relative_time(_time,"@d+14h+30m") &amp;lt;= _time OR _time &amp;lt; relative_time(_time,"@d+16h+30m"), "second")
| eval label2=if(relative_time(_time,"-1d@d+14h+30m") &amp;lt;= _time OR _time &amp;lt; relative_time(_time,"@d+16h+30m"),"third",NULL)
| eventstats dc(label) as label_count values(label2) as label2 by CurrentMouseName ExtraInfo
| where label_cont &amp;gt; 1 AND isnotnull(label2)
| table _time ,CurrentMouseName , ExtraInfo
| rename _time as newTime, CurrentMouseName as new3, ExtraInfo as newInfo
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I made it without &lt;CODE&gt;join&lt;/CODE&gt;.&lt;BR /&gt;
I am not sure &lt;EM&gt;oldInfo3&lt;/EM&gt; field.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Dec 2019 15:03:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-Multiple-joins-with-subsearch/m-p/496118#M138269</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2019-12-03T15:03:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine Multiple joins with subsearch?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-Multiple-joins-with-subsearch/m-p/496119#M138270</link>
      <description>&lt;P&gt;Why have you decided to use 3 joins? &lt;/P&gt;

&lt;P&gt;From what I can tell, it looks like the major difference between the 3 different subsearches is the time window. Would it be possible to use an &lt;CODE&gt;if&lt;/CODE&gt; or &lt;CODE&gt;case&lt;/CODE&gt; statement to rename fields based on when the events occur?&lt;/P&gt;

&lt;P&gt;An example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval TimeDiv1_Start = relative_time(now(), "@d+7h+30m")
| eval TimeDiv1_End = relative_time(now(), "@d+14h+30m")
| eval TimeDiv2_Start = relative_time(now(), "@d+14h+30m")
| eval TimeDiv2_End = relative_time(now(), "@d+16h+30m")
| eval TimeDiv3_Start = relative_time(now(), "-1d@d+16h+30m")
| eval TimeDiv3_End = relative_time(now(), "@d+16h+30m")
| eval TimeDiff = now() - _time
| eval TimeGroup = case((TimeDiff &amp;gt;= TimeDiv1_Start AND TimeDiff &amp;lt; TimeDiv1_End), "Bucket1", (TimeDiff &amp;gt;= TimeDiv2_Start AND TimeDiff &amp;lt; TimeDiv2_End), "Bucket2", (TimeDiff &amp;gt;= TimeDiv3_Start AND TimeDiff &amp;lt; TimeDiv2_End), "Bucket1", 1=1, null())
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Dec 2019 15:30:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-Multiple-joins-with-subsearch/m-p/496119#M138270</guid>
      <dc:creator>mstark31</dc:creator>
      <dc:date>2019-12-03T15:30:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine Multiple joins with subsearch?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-Multiple-joins-with-subsearch/m-p/496120#M138271</link>
      <description>&lt;P&gt;Hi &lt;/P&gt;

&lt;P&gt;This is query is regarding the Mouse Replacement.&lt;/P&gt;

&lt;P&gt;we have bluetooth mouse connected to iMacs, so when the mouse are moved from one desk to another Desk , we need get that of those desk number to where the mouse has moved along with mouse details hence we are using multiple joins to get the data.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Dec 2019 15:51:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-Multiple-joins-with-subsearch/m-p/496120#M138271</guid>
      <dc:creator>ravikanthbadugu</dc:creator>
      <dc:date>2019-12-03T15:51:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine Multiple joins with subsearch?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-Multiple-joins-with-subsearch/m-p/496121#M138272</link>
      <description>&lt;P&gt;If you can provide logs, we can create queries that do not use &lt;CODE&gt;Join&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Dec 2019 00:48:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-Multiple-joins-with-subsearch/m-p/496121#M138272</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2019-12-04T00:48:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine Multiple joins with subsearch?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-Multiple-joins-with-subsearch/m-p/496122#M138273</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(index=abc Source=WeeklyData earliest=@d+07h+30m latest=@d+14h+30m) OR
(index=abc Source=WeeklyData earliest=@d+14h+30m latest=@d+16h+30m) OR
(index=abc Source=WeeklyData earliest=-1d@d+16h+30m latest=@d+16h+30m)
| eval which=case(
   _time&amp;gt;=relative_time(now(), "@d+07h+30m") AND _time&amp;lt;=relative_time(now(), "@d+14h+30m"), "src1",
   _time&amp;gt;=relative_time(now(), "@d+14h+30m") AND _time&amp;lt;=relative_time(now(), "@d+16h+30m"), "src2",
   true(), "src3")
| eval joiner = if(which=="src3", CurrentMouseName, xy)
| eval cd = if(which=="src1", ExtraInfo, null())
| eval ef = if(which=="src2", ExtraInfo, null())
| eval xy = if(which=="src3", xy, null())
| eval newtime = if(which=="src3", _time, null())
| fields - _* ExtraInfo
| stats values(*) AS * BY joiner
| table joiner oldInfo3 newinfo newtime
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You might also do well to check out &lt;CODE&gt;timewrap&lt;/CODE&gt;:&lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.0.0/SearchReference/Timewrap"&gt;https://docs.splunk.com/Documentation/Splunk/8.0.0/SearchReference/Timewrap&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Dec 2019 06:33:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-Multiple-joins-with-subsearch/m-p/496122#M138273</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-12-04T06:33:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine Multiple joins with subsearch?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-Multiple-joins-with-subsearch/m-p/496123#M138274</link>
      <description>&lt;P&gt;The key thing is to avoid &lt;EM&gt;BOTH&lt;/EM&gt; &lt;CODE&gt;join&lt;/CODE&gt; and &lt;CODE&gt;subsearch&lt;/CODE&gt;, which is generally possible, like I did here.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2019 17:27:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-Multiple-joins-with-subsearch/m-p/496123#M138274</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-12-11T17:27:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine Multiple joins with subsearch?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-Multiple-joins-with-subsearch/m-p/496124#M138275</link>
      <description>&lt;P&gt;Hi When I am running the query I am getting this error&lt;/P&gt;

&lt;P&gt;Error in 'eval' command: The expression is malformed. Expected ).&lt;/P&gt;

&lt;P&gt;Please help.&lt;/P&gt;</description>
      <pubDate>Sat, 14 Dec 2019 09:36:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-Multiple-joins-with-subsearch/m-p/496124#M138275</guid>
      <dc:creator>ravikanthbadugu</dc:creator>
      <dc:date>2019-12-14T09:36:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine Multiple joins with subsearch?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-Multiple-joins-with-subsearch/m-p/496125#M138276</link>
      <description>&lt;P&gt;I was missing two &lt;CODE&gt;)&lt;/CODE&gt;; I re-edited and tested it.&lt;/P&gt;</description>
      <pubDate>Sat, 14 Dec 2019 15:41:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-Multiple-joins-with-subsearch/m-p/496125#M138276</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-12-14T15:41:45Z</dc:date>
    </item>
  </channel>
</rss>

