<?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: transaction command for same type of multiple events in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/transaction-command-for-same-type-of-multiple-events/m-p/696687#M236769</link>
    <description>&lt;P&gt;OK. From the top.&lt;/P&gt;&lt;P&gt;You have a set of events. Each event has the _time field describing when the event happened.&lt;/P&gt;&lt;P&gt;You're using the stats command to find earliest and latest (or min and max which in this case boils down to the same thing) values of this field for each uniqueId.&lt;/P&gt;&lt;P&gt;As an output you have three fields - starttime, endtime and uniqueId.&lt;/P&gt;&lt;P&gt;You no longer have the _time field.&lt;/P&gt;&lt;P&gt;Timechart must have the _time field since it, well, it charts over the time.&lt;/P&gt;&lt;P&gt;So you have to assign some value to the _time field manually. You can do it either by using eval as I showed previously or simply by adding another aggregation to your stats. For example&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats earliest(_time) as starttime,latest(_time) as endtime avg(_time) as _time by uniqueId&lt;/LI-CODE&gt;&lt;P&gt;That's just one of possible ways of doing that (of course you can use avg(_time), min(_time), max(_time) or any other aggregation function which makes sense in this context).&lt;/P&gt;</description>
    <pubDate>Mon, 19 Aug 2024 09:42:09 GMT</pubDate>
    <dc:creator>PickleRick</dc:creator>
    <dc:date>2024-08-19T09:42:09Z</dc:date>
    <item>
      <title>transaction command for same type of multiple events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/transaction-command-for-same-type-of-multiple-events/m-p/696494#M236718</link>
      <description>&lt;P&gt;Hi, I have a scenario where I want to calculate the duration between 1st and last event. The thing is these events can happen multiple times for the same session.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The 1st event can happen multiple times and everytime it is the exact same thing but I only want the transaction to start from very first event so that we know what is the exact duration.&lt;/P&gt;&lt;P&gt;Sample events below - See the last 2 events where one says MatchPending and another one says MatchCompleted.&lt;/P&gt;&lt;P&gt;What I want is to calculate the duration between 1st event and last event where it says MatchCompleted&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;2024-08-16 13:43:34,232|catalina-exec-192|INFO|LoggingClientHttpRequestInterceptor|Sending GET request to https://myapi.com/test
2024-08-16 13:43:38,630|catalina-exec-192|INFO|LoggingClientHttpRequestInterceptor|Response Received in 114 milliseconds "200 OK" response for GET request to https://myapi.com/test: "status":"MatchPending"
2024-08-16 13:43:50,516|catalina-exec-192|INFO|LoggingClientHttpRequestInterceptor|Sending GET request to https://myapi.com/test
2024-08-16 13:43:57,630|catalina-exec-192|INFO|LoggingClientHttpRequestInterceptor|Response Received in 114 milliseconds "200 OK" response for GET request to https://myapi.com/test: "status":"MatchPending"
2024-08-16 13:44:15,516|catalina-exec-192|INFO|LoggingClientHttpRequestInterceptor|Sending GET request to https://myapi.com/test
2024-08-16 13:43:50,510|catalina-exec-192|INFO|LoggingClientHttpRequestInterceptor|Response Received in 114 milliseconds "200 OK" response for GET request to https://myapi.com/test: "status":"MatchCompleted"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help is appreciated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;BR /&gt;Shashanlk&lt;/P&gt;</description>
      <pubDate>Fri, 16 Aug 2024 15:20:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/transaction-command-for-same-type-of-multiple-events/m-p/696494#M236718</guid>
      <dc:creator>sunny_871</dc:creator>
      <dc:date>2024-08-16T15:20:25Z</dc:date>
    </item>
    <item>
      <title>Re: transaction command for same type of multiple events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/transaction-command-for-same-type-of-multiple-events/m-p/696552#M236728</link>
      <description>&lt;P&gt;If you have identifier of each transaction such as transaction id, use stats to get the earliest and latest&lt;/P&gt;&lt;P&gt;for e.g.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;your search |earliest(_time) as starttime,latest(_time) as endtime by transactionID|eval duration=endtime-starttime&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 17 Aug 2024 02:34:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/transaction-command-for-same-type-of-multiple-events/m-p/696552#M236728</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2024-08-17T02:34:32Z</dc:date>
    </item>
    <item>
      <title>Re: transaction command for same type of multiple events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/transaction-command-for-same-type-of-multiple-events/m-p/696675#M236763</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/136781"&gt;@renjith_nair&lt;/a&gt;&amp;nbsp;Thanks for the response but I don't think your solution is fully working.&lt;/P&gt;&lt;P&gt;I tried it like below but then _time will not be available for me to plot the graph. I need to plot that duration on a graph. Is there a way to do that?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats earliest(_time) as starttime,latest(_time) as endtime by uniqueId 
| eval duration=endtime-starttime 
| timechart span=15m p95(duration) as p95Responsetime&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 19 Aug 2024 09:06:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/transaction-command-for-same-type-of-multiple-events/m-p/696675#M236763</guid>
      <dc:creator>sunny_871</dc:creator>
      <dc:date>2024-08-19T09:06:24Z</dc:date>
    </item>
    <item>
      <title>Re: transaction command for same type of multiple events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/transaction-command-for-same-type-of-multiple-events/m-p/696678#M236765</link>
      <description>&lt;P&gt;Since you're aggregating a relatively long-spanned set of events into a single data point you have to make a concious decision which point in time to assume as the timestamp for the result. You can easily assign a value to the _time field just by doing&lt;/P&gt;&lt;PRE&gt;| eval _time=something&lt;/PRE&gt;&lt;P&gt;But you have to decide which timestamp to use.&lt;/P&gt;&lt;P&gt;Is it the start time for your transaction? Is it the endtime? Maybe it's a middle of the transaction... It's up to you to make that decision.&lt;/P&gt;&lt;P&gt;Anyway, when dealing with _time in stats, there's not much point in using latest() and earliest(). min() and max() suffice &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2024 09:12:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/transaction-command-for-same-type-of-multiple-events/m-p/696678#M236765</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2024-08-19T09:12:00Z</dc:date>
    </item>
    <item>
      <title>Re: transaction command for same type of multiple events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/transaction-command-for-same-type-of-multiple-events/m-p/696680#M236766</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231884"&gt;@PickleRick&lt;/a&gt;&amp;nbsp;Apologies I dont think I have fully understood what you are trying to imply here.&lt;/P&gt;&lt;P&gt;My objective is to calculate duration between 2 set of events but one of those 2 events can happen multiple times. It is like sending a request to an API and then validate the response. If the response is not what was expected then send the same request again and keep sending until you get the expected response.&lt;/P&gt;&lt;P&gt;So my objective is to calculate the time when the 1st request was sent and when the last expected response was received.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;2024-08-16 13:43:34,232|catalina-exec-192|INFO|LoggingClientHttpRequestInterceptor|Sending GET request to https://myapi.com/test
2024-08-16 13:43:50,232|catalina-exec-192|INFO|LoggingClientHttpRequestInterceptor|Sending GET request to https://myapi.com/test
2024-08-16 13:44:14,232|catalina-exec-192|INFO|LoggingClientHttpRequestInterceptor|Sending GET request to https://myapi.com/test
2024-08-16 13:43:44,232|catalina-exec-192|INFO|LoggingClientHttpRequestInterceptor|Sending GET request to https://myapi.com/test

2024-08-16 13:43:57,510|catalina-exec-192|INFO|LoggingClientHttpRequestInterceptor|Response Received in 114 milliseconds "200 OK" response for GET request to https://myapi.com/test: "status":"MatchCompleted"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Please find the set of events again here.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2024 09:18:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/transaction-command-for-same-type-of-multiple-events/m-p/696680#M236766</guid>
      <dc:creator>sunny_871</dc:creator>
      <dc:date>2024-08-19T09:18:53Z</dc:date>
    </item>
    <item>
      <title>Re: transaction command for same type of multiple events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/transaction-command-for-same-type-of-multiple-events/m-p/696687#M236769</link>
      <description>&lt;P&gt;OK. From the top.&lt;/P&gt;&lt;P&gt;You have a set of events. Each event has the _time field describing when the event happened.&lt;/P&gt;&lt;P&gt;You're using the stats command to find earliest and latest (or min and max which in this case boils down to the same thing) values of this field for each uniqueId.&lt;/P&gt;&lt;P&gt;As an output you have three fields - starttime, endtime and uniqueId.&lt;/P&gt;&lt;P&gt;You no longer have the _time field.&lt;/P&gt;&lt;P&gt;Timechart must have the _time field since it, well, it charts over the time.&lt;/P&gt;&lt;P&gt;So you have to assign some value to the _time field manually. You can do it either by using eval as I showed previously or simply by adding another aggregation to your stats. For example&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats earliest(_time) as starttime,latest(_time) as endtime avg(_time) as _time by uniqueId&lt;/LI-CODE&gt;&lt;P&gt;That's just one of possible ways of doing that (of course you can use avg(_time), min(_time), max(_time) or any other aggregation function which makes sense in this context).&lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2024 09:42:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/transaction-command-for-same-type-of-multiple-events/m-p/696687#M236769</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2024-08-19T09:42:09Z</dc:date>
    </item>
  </channel>
</rss>

