<?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: Get time difference between events in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Get-time-difference-between-events/m-p/347139#M102773</link>
    <description>&lt;P&gt;@somesoni2 I tried:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; sourcetype=test  TransactionId=* RequestType=3
 | stats list(RequestType) as RequestTypes values(Customer) as Customer values(Action) as Action max(_time) as last_time by TransactionId
 | where isnull(mvfind(RequestTypes,"16"))
 | eval latency_minutes=((now()-last_time)/60) | convert ctime(last_time) as last_time
 | fields - RequestTypes
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It gives the results alongwith many other incorrect rows, reason being for some tranasctions, the order of the RequestType is 16,3,5,5 and 3,16,5,5&lt;/P&gt;

&lt;P&gt;I believe we will need to check if for a transaction, we have action "UpdateTaskExecutionHistory" written or not&lt;/P&gt;</description>
    <pubDate>Tue, 13 Feb 2018 08:54:02 GMT</pubDate>
    <dc:creator>siddharthmis</dc:creator>
    <dc:date>2018-02-13T08:54:02Z</dc:date>
    <item>
      <title>Get time difference between events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-time-difference-between-events/m-p/347130#M102764</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have events like following (in the sequence of occurrence)-&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;{"TransactionId":"570978b406264e398d888cd8b49f867d","ParentId":"","RequestId":"24529c4700e942e1ba036f87b0d6080e","Customer":"86c62bf7f6ee4a1ab004e7e33ad9068a","Action":"ExecuteWCFTask/TestRun","Start":"2018-02-05T08:08:42.4689427+00:00","End":"2018-02-05T08:08:42.9378465+00:00","RequestType":3}&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;{"TransactionId":"570978b406264e398d888cd8b49f867d","ParentId":"24529c4700e942e1ba036f87b0d6080e","RequestId":"c0114983065a45fb83efa433f093ce06","Customer":"86c62bf7f6ee4a1ab004e7e33ad9068a","Action":"ExecuteWCFTaskService/StartTask","Start":"2018-02-05T08:08:42.48456+00:00","End":"2018-02-05T08:08:42.5158124+00:00","RequestType":5}&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;{"TransactionId":"570978b406264e398d888cd8b49f867d","ParentId":"c0114983065a45fb83efa433f093ce06","RequestId":"0d1438b1e8af4021a7848314f9e88daf","Customer":"86c62bf7f6ee4a1ab004e7e33ad9068a","Action":"TestRun","Start":"2018-02-05T08:08:42.634785+00:00","End":"2018-02-05T09:54:19.5054132+00:00","RequestType":16}&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;{"TransactionId":"570978b406264e398d888cd8b49f867d","ParentId":"0d1438b1e8af4021a7848314f9e88daf","RequestId":"bb95c271d2ef412d89bebe74f5db4aff","Customer":"86c62bf7f6ee4a1ab004e7e33ad9068a","Action":"UpdateTaskExecutionHistory","Start":"2018-02-05T09:54:48.2226293+00:00","End":"2018-02-05T09:54:48.2382566+00:00","RequestType":5}&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;The sequence is always the same, i.e. first we have request type 3, then 5, then 16 and then 5.&lt;/STRONG&gt;&lt;BR /&gt;
&lt;STRONG&gt;Request ID of the first event is the parent ID of second.&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;The Only parameter common in all events in the TransactionId.&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;In the above example, Event with RequestType 16 was logged almost 106 minutes after event with RequestType 5 was logged.&lt;/P&gt;

&lt;P&gt;I need the Customer and Action from the events whose requestType 16 is not received in real-time.&lt;/P&gt;

&lt;P&gt;For e.g. If event with request type 5 is logged at 0500 UTC and search is run at 0700 UTC, I would like to get the customer and action of the event whose requestType 16 is still not logged.&lt;/P&gt;

&lt;P&gt;I tried something like-&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=test  TransactionId=* RequestType=3 | eval epocs=strptime(Start, "%Y-%m-%dT%H:%M:%S.%f") | eval epoce=strptime(End, "%Y-%m-%dT%H:%M:%S.%f")  | stats max(_time) as last_time by Customer, TransactionId | eval latency_minutes=((now()-last_time)/60) | convert ctime(last_time) as last_time | fields + Customer, TransactionId, last_time, latency_minutes
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But it didn't help.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2018 05:58:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-time-difference-between-events/m-p/347130#M102764</guid>
      <dc:creator>siddharthmis</dc:creator>
      <dc:date>2018-02-06T05:58:57Z</dc:date>
    </item>
    <item>
      <title>Re: Get time difference between events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-time-difference-between-events/m-p/347131#M102765</link>
      <description>&lt;P&gt;I think one possible way to find what I am looking for is to get the transactionID of the event with requestType 5 whose requestId is not the parentId of any event.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2018 06:02:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-time-difference-between-events/m-p/347131#M102765</guid>
      <dc:creator>siddharthmis</dc:creator>
      <dc:date>2018-02-06T06:02:20Z</dc:date>
    </item>
    <item>
      <title>Re: Get time difference between events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-time-difference-between-events/m-p/347132#M102766</link>
      <description>&lt;P&gt;Can anyone please suggest what can be done?&lt;/P&gt;</description>
      <pubDate>Wed, 07 Feb 2018 05:21:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-time-difference-between-events/m-p/347132#M102766</guid>
      <dc:creator>siddharthmis</dc:creator>
      <dc:date>2018-02-07T05:21:00Z</dc:date>
    </item>
    <item>
      <title>Re: Get time difference between events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-time-difference-between-events/m-p/347133#M102767</link>
      <description>&lt;P&gt;do you basically need to know at the time of your search if all four events have been logged for every transaction? If that's the case, you could just do  &lt;CODE&gt;sourcetype=test  TransactionId=*|transaction TransactionId maxspan=1h maxpause=10m|where eventcount&amp;lt;4&lt;/CODE&gt;, if needed you could continue with your &lt;BR /&gt;
 &lt;CODE&gt;|stats max(_time) as latest_time  by Customer, TransactionId....&lt;/CODE&gt; but this should get you any transaction that didn't reach all four events.&lt;BR /&gt;
you can also adjust the maxspan/maxpause in the transaction command to suit your needs. There are other arguments available, as well.&lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/Splunk/7.0.2/SearchReference/Transaction"&gt;https://docs.splunk.com/Documentation/Splunk/7.0.2/SearchReference/Transaction&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Feb 2018 13:38:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-time-difference-between-events/m-p/347133#M102767</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2018-02-07T13:38:42Z</dc:date>
    </item>
    <item>
      <title>Re: Get time difference between events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-time-difference-between-events/m-p/347134#M102768</link>
      <description>&lt;P&gt;I ran-&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=test TransactionId=* |transaction TransactionId maxspan=-1 maxpause=-1 | where (eventcount&amp;lt;3 and eventcount&amp;gt;1)  | stats max(_time) as last_time by Customer, TransactionId | eval latency_minutes=((now()-last_time)/60) | convert ctime(last_time) as last_time | fields + Customer, TransactionId, last_time, latency_minutes
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It gave my what I need but a lot of incorrect rows-&lt;/P&gt;

&lt;P&gt;It returned the TransactionId - 309fe4177f9f41ba9141de2d1fed71a7 for which raw events were:&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;{"TransactionId":"309fe4177f9f41ba9141de2d1fed71a7","ParentId":"","RequestId":"941a38abcfe24a64b83417d76b8ce08d","Customer":"Dummy","Action":"ExecuteWCFTask/Check","Start":"2018-02-08T02:07:35.0661083+00:00","End":"2018-02-08T02:07:35.2067272+00:00","RequestType":3}&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;{"TransactionId":"309fe4177f9f41ba9141de2d1fed71a7","ParentId":"941a38abcfe24a64b83417d76b8ce08d","RequestId":"8bd669290510421faa744def84043357","Customer":"Dummy","Action":"ExecuteWCFTaskService/StartTask","End":"2018-02-08T02:07:35.2067272+00:00","RequestType":5}&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;{"TransactionId":"309fe4177f9f41ba9141de2d1fed71a7","ParentId":"8bd669290510421faa744def84043357","RequestId":"f03d9c78-6223-4ffe-9e26-76e0ea81b029","Customer":"Dummy","Action":"Check","Start":"2018-02-08T02:07:51.9417927+00:00","End":"2018-02-08T03:40:53.6402105+00:00","RequestType":16}&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;{"TransactionId":"309fe4177f9f41ba9141de2d1fed71a7","ParentId":"2f15f976e3d54fa6b91872a32c0f60d0","RequestId":"26f038288d2f46a7b88772a9b1402ec3","Customer":"Dummy","Action":"UpdateTaskExecutionHistory","Start":"2018-02-08T03:41:09.4014092+00:00","End":"2018-02-08T03:41:09.4170427+00:00","RequestType":5}&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2018 06:22:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-time-difference-between-events/m-p/347134#M102768</guid>
      <dc:creator>siddharthmis</dc:creator>
      <dc:date>2018-02-08T06:22:56Z</dc:date>
    </item>
    <item>
      <title>Re: Get time difference between events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-time-difference-between-events/m-p/347135#M102769</link>
      <description>&lt;P&gt;I think it would be good if we can get the transaction details whose RequestType 3 is logged but RequestType 16 is not and the latency minutes.&lt;/P&gt;

&lt;P&gt;basically I am looking for long running transactions, RequestType 16 is logged after the transaction is complete, so I have to rely on RequestType 3 for the details.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2018 06:44:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-time-difference-between-events/m-p/347135#M102769</guid>
      <dc:creator>siddharthmis</dc:creator>
      <dc:date>2018-02-08T06:44:29Z</dc:date>
    </item>
    <item>
      <title>Re: Get time difference between events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-time-difference-between-events/m-p/347136#M102770</link>
      <description>&lt;P&gt;Any ideas Anyone?&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2018 15:31:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-time-difference-between-events/m-p/347136#M102770</guid>
      <dc:creator>siddharthmis</dc:creator>
      <dc:date>2018-02-12T15:31:37Z</dc:date>
    </item>
    <item>
      <title>Re: Get time difference between events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-time-difference-between-events/m-p/347137#M102771</link>
      <description>&lt;P&gt;@somesoni2, can you help me out here?&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2018 15:36:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-time-difference-between-events/m-p/347137#M102771</guid>
      <dc:creator>siddharthmis</dc:creator>
      <dc:date>2018-02-12T15:36:52Z</dc:date>
    </item>
    <item>
      <title>Re: Get time difference between events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-time-difference-between-events/m-p/347138#M102772</link>
      <description>&lt;P&gt;Give this a try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=test  TransactionId=* RequestType=3 OR RequestType=5 OR RequestType=16
| stats list(RequestType) as RequestTypes values(Customer) as Customer values(Action) as Action max(_time) as last_time by TransactionId
| where isnull(mvfind(RequestTypes,"16"))
| eval latency_minutes=((now()-last_time)/60) | convert ctime(last_time) as last_time
| fields - RequestTypes
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 12 Feb 2018 19:13:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-time-difference-between-events/m-p/347138#M102772</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2018-02-12T19:13:33Z</dc:date>
    </item>
    <item>
      <title>Re: Get time difference between events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-time-difference-between-events/m-p/347139#M102773</link>
      <description>&lt;P&gt;@somesoni2 I tried:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; sourcetype=test  TransactionId=* RequestType=3
 | stats list(RequestType) as RequestTypes values(Customer) as Customer values(Action) as Action max(_time) as last_time by TransactionId
 | where isnull(mvfind(RequestTypes,"16"))
 | eval latency_minutes=((now()-last_time)/60) | convert ctime(last_time) as last_time
 | fields - RequestTypes
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It gives the results alongwith many other incorrect rows, reason being for some tranasctions, the order of the RequestType is 16,3,5,5 and 3,16,5,5&lt;/P&gt;

&lt;P&gt;I believe we will need to check if for a transaction, we have action "UpdateTaskExecutionHistory" written or not&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2018 08:54:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-time-difference-between-events/m-p/347139#M102773</guid>
      <dc:creator>siddharthmis</dc:creator>
      <dc:date>2018-02-13T08:54:02Z</dc:date>
    </item>
    <item>
      <title>Re: Get time difference between events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-time-difference-between-events/m-p/347140#M102774</link>
      <description>&lt;P&gt;@somesoni2, maybe something like -&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=_json source="http:alusta_etw"  Instance=UK4 Action="*ANYERP*" TransactionId=*  RequestType=3 OR RequestType=5 OR RequestType=16   | stats list(RequestType) as RequestTypes values(TenantCode) as TenantCode list(Action) as Actions max(_time) as last_time by TransactionId  | where isnull(mvfind(Actions,"SchedulerTaskHistoryUpdateGatewayService/UpdateTaskExecutionHistory")) | eval latency_minutes=((now()-last_time)/60) | convert ctime(last_time) as last_time  | fields - RequestTypes
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 14 Feb 2018 13:47:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-time-difference-between-events/m-p/347140#M102774</guid>
      <dc:creator>siddharthmis</dc:creator>
      <dc:date>2018-02-14T13:47:02Z</dc:date>
    </item>
  </channel>
</rss>

