<?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 two result with different times in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/join-two-result-with-different-times/m-p/359883#M106384</link>
    <description>&lt;P&gt;I have a use case, where in I need data from different dates compared to previous days.  so, I have a time picker and a previous days dropdown with 1,2,3,4,5,6,7,8,9,10 days option.&lt;/P&gt;

&lt;P&gt;e.g. there may be a case where in I need to compare today with last 5 days. So, I will select today from time range and previous 5 days from dropdown.&lt;/P&gt;

&lt;P&gt;case 2. : I can select date range from time picker and then compare with any number of days.&lt;/P&gt;

&lt;P&gt;I used join: index=abc earliest=$time_tok.earliest$- $days_selected$ latest=$time_tok.earliest$|stats count(host) by source|join type=left source[index=abc earliest=$time_tok.earliest$ latest=$time_tok.latest$|stats count(host) by source].&lt;/P&gt;

&lt;P&gt;tried using daysago as well, but it is very very slow.&lt;/P&gt;

&lt;P&gt;Please provide some pointers.&lt;BR /&gt;
Best,&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 18:32:40 GMT</pubDate>
    <dc:creator>splunkdivya</dc:creator>
    <dc:date>2020-09-29T18:32:40Z</dc:date>
    <item>
      <title>join two result with different times</title>
      <link>https://community.splunk.com/t5/Splunk-Search/join-two-result-with-different-times/m-p/359883#M106384</link>
      <description>&lt;P&gt;I have a use case, where in I need data from different dates compared to previous days.  so, I have a time picker and a previous days dropdown with 1,2,3,4,5,6,7,8,9,10 days option.&lt;/P&gt;

&lt;P&gt;e.g. there may be a case where in I need to compare today with last 5 days. So, I will select today from time range and previous 5 days from dropdown.&lt;/P&gt;

&lt;P&gt;case 2. : I can select date range from time picker and then compare with any number of days.&lt;/P&gt;

&lt;P&gt;I used join: index=abc earliest=$time_tok.earliest$- $days_selected$ latest=$time_tok.earliest$|stats count(host) by source|join type=left source[index=abc earliest=$time_tok.earliest$ latest=$time_tok.latest$|stats count(host) by source].&lt;/P&gt;

&lt;P&gt;tried using daysago as well, but it is very very slow.&lt;/P&gt;

&lt;P&gt;Please provide some pointers.&lt;BR /&gt;
Best,&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 18:32:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/join-two-result-with-different-times/m-p/359883#M106384</guid>
      <dc:creator>splunkdivya</dc:creator>
      <dc:date>2020-09-29T18:32:40Z</dc:date>
    </item>
    <item>
      <title>Re: join two result with different times</title>
      <link>https://community.splunk.com/t5/Splunk-Search/join-two-result-with-different-times/m-p/359884#M106385</link>
      <description>&lt;P&gt;How much data you have? &lt;BR /&gt;
What is your HW configuration?&lt;BR /&gt;
Dont you have other filter conditions available?&lt;/P&gt;</description>
      <pubDate>Tue, 20 Mar 2018 06:45:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/join-two-result-with-different-times/m-p/359884#M106385</guid>
      <dc:creator>strive</dc:creator>
      <dc:date>2018-03-20T06:45:06Z</dc:date>
    </item>
    <item>
      <title>Re: join two result with different times</title>
      <link>https://community.splunk.com/t5/Splunk-Search/join-two-result-with-different-times/m-p/359885#M106386</link>
      <description>&lt;P&gt;If your query is accurate, then you don't need to use stats, you can just use tstats, which is 1000x faster:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats count(host) where index=abc AND earliest=$time_tok.earliest$- $days_selected$ AND latest=$time_tok.earliest$ by source
| join type=left source 
    [| tstats count(host) as C2 where index=_internal AND earliest=$time_tok.earliest$ AND latest=$time_tok.latest$ by source ]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 20 Mar 2018 07:59:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/join-two-result-with-different-times/m-p/359885#M106386</guid>
      <dc:creator>tiagofbmm</dc:creator>
      <dc:date>2018-03-20T07:59:17Z</dc:date>
    </item>
    <item>
      <title>Re: join two result with different times</title>
      <link>https://community.splunk.com/t5/Splunk-Search/join-two-result-with-different-times/m-p/359886#M106387</link>
      <description>&lt;P&gt;Is there a way out to avoid join here?&lt;/P&gt;</description>
      <pubDate>Tue, 20 Mar 2018 08:28:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/join-two-result-with-different-times/m-p/359886#M106387</guid>
      <dc:creator>splunkdivya</dc:creator>
      <dc:date>2018-03-20T08:28:16Z</dc:date>
    </item>
    <item>
      <title>Re: join two result with different times</title>
      <link>https://community.splunk.com/t5/Splunk-Search/join-two-result-with-different-times/m-p/359887#M106388</link>
      <description>&lt;P&gt;Have you tried how faster the query above runs?&lt;/P&gt;</description>
      <pubDate>Tue, 20 Mar 2018 08:31:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/join-two-result-with-different-times/m-p/359887#M106388</guid>
      <dc:creator>tiagofbmm</dc:creator>
      <dc:date>2018-03-20T08:31:57Z</dc:date>
    </item>
    <item>
      <title>Re: join two result with different times</title>
      <link>https://community.splunk.com/t5/Splunk-Search/join-two-result-with-different-times/m-p/359888#M106389</link>
      <description>&lt;P&gt;Please let me know if the answer was useful for you. If it was, accept it and upvote. If not, give us more input so we can help you with that&lt;/P&gt;</description>
      <pubDate>Wed, 21 Mar 2018 17:28:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/join-two-result-with-different-times/m-p/359888#M106389</guid>
      <dc:creator>tiagofbmm</dc:creator>
      <dc:date>2018-03-21T17:28:12Z</dc:date>
    </item>
    <item>
      <title>Re: join two result with different times</title>
      <link>https://community.splunk.com/t5/Splunk-Search/join-two-result-with-different-times/m-p/359889#M106390</link>
      <description>&lt;P&gt;I do something similar in the following search. It grabs the past 30 minutes and the prior three weeks same 30 minute window and averages the historical data to establish "normal" and then displays "now" in the same timechart. I thought this would give you something to work from. Not the prettiest search, but it works.&lt;/P&gt;

&lt;P&gt;index=main earliest=-30m@m latest=-0m@m host="xxxxxxx"&lt;BR /&gt;
 | timechart span=30s count as TOTAL&lt;BR /&gt;
 | eval ReportKey="Last30"&lt;BR /&gt;
 | append [search index=main  host="xxxxxxx" earliest=-10110m@m latest=-10080m@m&lt;BR /&gt;
 | timechart span=30s count as TOT&lt;BR /&gt;
 | eval ReportKey="1WkAgo"&lt;BR /&gt;
 | eval _time=_time+604800]&lt;BR /&gt;
 | append [search index=main  host="xxxxxxx" earliest=-20190m@m latest=-20160m@m&lt;BR /&gt;
 | timechart span=30s count as TOT &lt;BR /&gt;
 | eval ReportKey="2WksAgo"&lt;BR /&gt;
 | eval _time=_time+1209600]&lt;BR /&gt;
 | append [search index=main  host="xxxxxxx" earliest=-30270m@m latest=-30240m@m&lt;BR /&gt;
 | timechart span=30s count as TOT &lt;BR /&gt;
 | eval ReportKey="3WksAgo"&lt;BR /&gt;
 | eval _time=_time+1814400 ]&lt;BR /&gt;
 | timechart avg(TOT) as Three_week_average values(TOTAL) as The_previous_30_minutes &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:07:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/join-two-result-with-different-times/m-p/359889#M106390</guid>
      <dc:creator>mydog8it</dc:creator>
      <dc:date>2020-09-29T20:07:44Z</dc:date>
    </item>
  </channel>
</rss>

