<?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 do you join independent query results? in Alerting</title>
    <link>https://community.splunk.com/t5/Alerting/How-do-you-join-independent-query-results/m-p/397023#M11937</link>
    <description>&lt;P&gt;@renjith.nair &lt;/P&gt;

&lt;P&gt;Thanks Renjith. This works exactly as I wanted. &lt;BR /&gt;
Another point I wanted to add is that : &lt;BR /&gt;
1. endTime is in EST &lt;BR /&gt;
2. startTime is in GMT.&lt;/P&gt;

&lt;P&gt;I need to convert the startTime from GMT to EST and then calculate the time difference in milliseconds.&lt;/P&gt;

&lt;P&gt;I tried relative_now but was not able to achieve my case. Can you suggest on how this can be done.&lt;/P&gt;

&lt;P&gt;Once the time difference is calculted, I need to show the timechart for the average of time taken over past 30 days with a span of 1 day.&lt;/P&gt;</description>
    <pubDate>Wed, 21 Nov 2018 13:19:09 GMT</pubDate>
    <dc:creator>rohit_kothuru</dc:creator>
    <dc:date>2018-11-21T13:19:09Z</dc:date>
    <item>
      <title>How do you join independent query results?</title>
      <link>https://community.splunk.com/t5/Alerting/How-do-you-join-independent-query-results/m-p/397021#M11935</link>
      <description>&lt;P&gt;I have 2 logs like below :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2018-11-20 04:41:23,873.873 - MainThread - 49102 - INFO views -  endTime - 2018-11-20 04:41:23.870460 reqId - id 
2018-11-20 04:41:23,863.863 - MainThread - 49102 - INFO views -  reqID - id , startTime - 2018-11-20 09:41:23.234
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;From first statement I need reqId and endTime.&lt;/P&gt;

&lt;P&gt;From second statement I need reqId and startTime.&lt;/P&gt;

&lt;P&gt;I need to join both the results and retrieve startTime and endTime for each reqId and calculte the time taken.&lt;/P&gt;

&lt;P&gt;Can someone please help me to form a query to join the results.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Nov 2018 10:26:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-do-you-join-independent-query-results/m-p/397021#M11935</guid>
      <dc:creator>rohit_kothuru</dc:creator>
      <dc:date>2018-11-20T10:26:49Z</dc:date>
    </item>
    <item>
      <title>Re: How do you join independent query results?</title>
      <link>https://community.splunk.com/t5/Alerting/How-do-you-join-independent-query-results/m-p/397022#M11936</link>
      <description>&lt;P&gt;@rohit_kothuru ,&lt;/P&gt;

&lt;P&gt;Give this a try,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex field=_raw "(?i)reqId\s-\s(?&amp;lt;reqId&amp;gt;\d+)" 
| rex field=_raw "startTime - (?&amp;lt;startTime&amp;gt;\d{4}-\d{1,2}-\d{1,2} \d{2}:\d{2}:\d{2}.\d{1,9})" 
| rex field=_raw "endTime - (?&amp;lt;endTime&amp;gt;\d{4}-\d{1,2}-\d{1,2} \d{2}:\d{2}:\d{2}.\d{1,9})"
| stats last(startTime) as startTime,last(endTime) as endTime by  reqId|eval TimeTaken=strptime(endTime,"%Y-%m-%d %H:%M:%S.%9N") - strptime(startTime,"%Y-%m-%d %H:%M:%S.%9N") 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You might need to fine tune the rex part  based on your actual event&lt;/P&gt;</description>
      <pubDate>Tue, 20 Nov 2018 15:40:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-do-you-join-independent-query-results/m-p/397022#M11936</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2018-11-20T15:40:57Z</dc:date>
    </item>
    <item>
      <title>Re: How do you join independent query results?</title>
      <link>https://community.splunk.com/t5/Alerting/How-do-you-join-independent-query-results/m-p/397023#M11937</link>
      <description>&lt;P&gt;@renjith.nair &lt;/P&gt;

&lt;P&gt;Thanks Renjith. This works exactly as I wanted. &lt;BR /&gt;
Another point I wanted to add is that : &lt;BR /&gt;
1. endTime is in EST &lt;BR /&gt;
2. startTime is in GMT.&lt;/P&gt;

&lt;P&gt;I need to convert the startTime from GMT to EST and then calculate the time difference in milliseconds.&lt;/P&gt;

&lt;P&gt;I tried relative_now but was not able to achieve my case. Can you suggest on how this can be done.&lt;/P&gt;

&lt;P&gt;Once the time difference is calculted, I need to show the timechart for the average of time taken over past 30 days with a span of 1 day.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Nov 2018 13:19:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-do-you-join-independent-query-results/m-p/397023#M11937</guid>
      <dc:creator>rohit_kothuru</dc:creator>
      <dc:date>2018-11-21T13:19:09Z</dc:date>
    </item>
    <item>
      <title>Re: How do you join independent query results?</title>
      <link>https://community.splunk.com/t5/Alerting/How-do-you-join-independent-query-results/m-p/397024#M11938</link>
      <description>&lt;P&gt;Considering EST is 5 hours behind GMT, try adding -0500 (hhmm) to the time&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;eval startTime=startTime+ "-0500"&lt;/CODE&gt; before the difference calculation and then use strptime(startTime,"%Y-%m-%d %H:%M:%S.%9N%z") &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;The timezone offset from UTC, in hour and minute: +hhmm or -hhmm. For example, for 5 hours before UTC the values is -0500 which is US Eastern Standard Time.

Examples:

    Use %z to specify hour and minute, for example -0500
    Use %:z to specify hour and minute separated by a colon, for example -5:00
    Use %::z to specify hour minute and second separated with colons, for example -05:00:00
    Use %:::z to specify hour only, for example -05
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 22 Nov 2018 09:18:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-do-you-join-independent-query-results/m-p/397024#M11938</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2018-11-22T09:18:41Z</dc:date>
    </item>
    <item>
      <title>Re: How do you join independent query results?</title>
      <link>https://community.splunk.com/t5/Alerting/How-do-you-join-independent-query-results/m-p/397025#M11939</link>
      <description>&lt;P&gt;That is a different question so ask in another post.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Dec 2018 22:23:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-do-you-join-independent-query-results/m-p/397025#M11939</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2018-12-03T22:23:47Z</dc:date>
    </item>
  </channel>
</rss>

