<?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: Calculate response time from starttime and endtime in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Calculate-response-time-from-starttime-and-endtime/m-p/93714#M24137</link>
    <description>&lt;P&gt;Thank you guys, it's working now.&lt;BR /&gt;
Have a good day!&lt;/P&gt;</description>
    <pubDate>Tue, 16 Jul 2013 12:02:55 GMT</pubDate>
    <dc:creator>tamasvincze</dc:creator>
    <dc:date>2013-07-16T12:02:55Z</dc:date>
    <item>
      <title>Calculate response time from starttime and endtime</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-response-time-from-starttime-and-endtime/m-p/93704#M24127</link>
      <description>&lt;P&gt;Hi everyone!&lt;/P&gt;

&lt;P&gt;Where i work, we have a little problem with the sql server, so i made a java program to test it.&lt;BR /&gt;
I have a nice log, which contains rows like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Sent;2013-07-12 10:00:06.561;3c34c5e2a32c8b1a7b853958207d223f
Sent;2013-07-12 10:00:06.546;7792eff1b42c35e7a208ffec68f63220
Sent;2013-07-12 10:00:06.561;d86dd547438271f2c5bc6c2bceb7e6f3
Sent;2013-07-12 10:00:06.561;3c126ec175261f75fcbc567c5c89751d
Received;2013-07-12 10:00:07.984;d86dd547438271f2c5bc6c2bceb7e6f3
Received;2013-07-12 10:00:07.984;7792eff1b42c35e7a208ffec68f63220
Timeout;2013-07-12 10:00:07.796;3c34c5e2a32c8b1a7b853958207d223f
Timeout;2013-07-12 10:00:07.984;3c126ec175261f75fcbc567c5c89751d
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I would like to pair every Sent and Receives row with the last field (like in the forst row: 3c34c5e2a..., it is a unique id)&lt;BR /&gt;
I just started using splunk, and as i see i'll need these keyword: transaction, field extract (, and chart for seeing these beautiful response times)&lt;/P&gt;

&lt;P&gt;I tried something like this:&lt;BR /&gt;
... | reverse | transaction ";[a-z0-9]*" &lt;/P&gt;

&lt;P&gt;As i think every row will be a transaction (or not?), and i need the last string (that's why the regexp). Maybe i'm going to the wrong direction?&lt;/P&gt;

&lt;P&gt;I also have some "TIMEOUT;2013-07-12 11:00:43.409;c3926c0fa748e0c5189fd8cc1c433625" rows as well, and they are paired like SENT-TIMEOUT. But i think the SENT-RECEIVED pair duration is enough, maybe i'll figure out how to do it one more time.&lt;/P&gt;

&lt;P&gt;Can you guys help me how to do it? &lt;/P&gt;

&lt;P&gt;EDIT:&lt;BR /&gt;
the final goal is to have some kind of table like this:&lt;BR /&gt;
c3926c0fa748e0c5189fd8cc1c433625 34&lt;BR /&gt;
as23sf...                        435&lt;BR /&gt;
kj23df...                        96&lt;/P&gt;

&lt;P&gt;where the strings are the unique IDs to pair the requests and responses, and the number is the endtime-starttime in millisecond/second/buzzlightyear &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
Tom&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jul 2013 09:55:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-response-time-from-starttime-and-endtime/m-p/93704#M24127</guid>
      <dc:creator>tamasvincze</dc:creator>
      <dc:date>2013-07-12T09:55:12Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate response time from starttime and endtime</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-response-time-from-starttime-and-endtime/m-p/93705#M24128</link>
      <description>&lt;P&gt;you cannot use regular expression directly in combination with transaction, you need to create a field for unique Id and then use transaction command with that field.&lt;/P&gt;

&lt;P&gt;something like " | rex";(?UniqueID)[a-z0-9]*" | transaction UniqueID "&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jul 2013 10:37:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-response-time-from-starttime-and-endtime/m-p/93705#M24128</guid>
      <dc:creator>adityapavan18</dc:creator>
      <dc:date>2013-07-12T10:37:24Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate response time from starttime and endtime</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-response-time-from-starttime-and-endtime/m-p/93706#M24129</link>
      <description>&lt;P&gt;Hi, you're right, it's even better to use [a-z0-9]{32} (that string always has the length of 32).&lt;/P&gt;

&lt;P&gt;But i was wondering: do i need to make transactions? I don't really see it. As i think I'll need field extract and/or kv.&lt;/P&gt;

&lt;P&gt;My logic here is:&lt;BR /&gt;
original data -&amp;gt; get all the sent and received and sent and timeout -&amp;gt; pair them with that ID-&amp;gt; get the duration by substracting starttime from endtime -&amp;gt; at this point i have the ID and the duration -&amp;gt; everyone's happy&lt;/P&gt;

&lt;P&gt;Is is hard to do with splunk?&lt;BR /&gt;
(I am really a newbie, my colleague showed me splunk like  weeks ago, so i have absolutely no experience)&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jul 2013 12:27:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-response-time-from-starttime-and-endtime/m-p/93706#M24129</guid>
      <dc:creator>tamasvincze</dc:creator>
      <dc:date>2013-07-12T12:27:53Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate response time from starttime and endtime</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-response-time-from-starttime-and-endtime/m-p/93707#M24130</link>
      <description>&lt;P&gt;The other way without using transaction is by stats command&lt;/P&gt;

&lt;P&gt;| stats earliest(_time) as earliest latest(_time) as latest by UniqueID | eval duration = latest - earliest&lt;/P&gt;

&lt;P&gt;this can be used instead of transaction, and  also its faster...&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 14:19:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-response-time-from-starttime-and-endtime/m-p/93707#M24130</guid>
      <dc:creator>adityapavan18</dc:creator>
      <dc:date>2020-09-28T14:19:58Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate response time from starttime and endtime</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-response-time-from-starttime-and-endtime/m-p/93708#M24131</link>
      <description>&lt;P&gt;hi again!&lt;BR /&gt;
sorry for late answer, i had other things.&lt;BR /&gt;
I tried this:&lt;BR /&gt;
source="C:\logpath\log1.txt" | reverse | rex "(?i)([a-z]|[0-9]){32}(?P&lt;MESSAGEID&gt;)" | transaction MessageID&lt;/MESSAGEID&gt;&lt;/P&gt;

&lt;P&gt;but the problem, that i have only 20 transaction groups, and each one have ~1000 rows (i have ~20000 row in the log file)&lt;/P&gt;

&lt;P&gt;what is the problem with this regexp? I tried in in some interpreter, and it should get only the 32 long identifier, and then the transaction should pair them (each sent should be paired with a received, or a timeout). Or do i misunderstand this procedure?&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jul 2013 08:35:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-response-time-from-starttime-and-endtime/m-p/93708#M24131</guid>
      <dc:creator>tamasvincze</dc:creator>
      <dc:date>2013-07-16T08:35:51Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate response time from starttime and endtime</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-response-time-from-starttime-and-endtime/m-p/93709#M24132</link>
      <description>&lt;P&gt;first , you need to check if your rex command get correct result &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=tamasvincze | rex ";(?P&amp;lt;UniqueID&amp;gt;([a-z]|[0-9]){32})" | table UniqueID
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;if the result is correct, then run :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=tamasvincze | rex ";(?P&amp;lt;UniqueID&amp;gt;([a-z]|[0-9]){32})" | transaction UniqueID
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;please note, the field name is case sensitive&lt;/P&gt;

&lt;P&gt;I use your example log , run above command I pasted and I got four groups&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Sent;2013-07-12 10:00:06.561;3c34c5e2a32c8b1a7b853958207d223f
Timeout;2013-07-12 10:00:07.796;3c34c5e2a32c8b1a7b853958207d223f
duration=1.235  

Sent;2013-07-12 10:00:06.561;d86dd547438271f2c5bc6c2bceb7e6f3
Received;2013-07-12 10:00:07.984;d86dd547438271f2c5bc6c2bceb7e6f3
duration=1.423  

Sent;2013-07-12 10:00:06.561;3c126ec175261f75fcbc567c5c89751d
Timeout;2013-07-12 10:00:07.984;3c126ec175261f75fcbc567c5c89751d
duration=1.423   

Sent;2013-07-12 10:00:06.546;7792eff1b42c35e7a208ffec68f63220
Received;2013-07-12 10:00:07.984;7792eff1b42c35e7a208ffec68f63220
duration=1.438   
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 16 Jul 2013 09:06:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-response-time-from-starttime-and-endtime/m-p/93709#M24132</guid>
      <dc:creator>dmlee</dc:creator>
      <dc:date>2013-07-16T09:06:49Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate response time from starttime and endtime</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-response-time-from-starttime-and-endtime/m-p/93710#M24133</link>
      <description>&lt;P&gt;Oh. So first, i tried all the way with a wrong reg expression... Okay, now it looks nicer, but when i'm trying to get the duration calculation, something goes wrong...&lt;/P&gt;

&lt;P&gt;The eariest and latest times are the same. &lt;BR /&gt;
My  search string: sourcetype="rel_sample" | rex ";(?P&lt;UNIQUEID&gt;([a-z0-9]){32})" | transaction UniqueID | stats earliest(_time) as earliest latest(_time) as latest by UniqueID&lt;BR /&gt;
What did i mess up?&lt;/UNIQUEID&gt;&lt;/P&gt;

&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 14:21:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-response-time-from-starttime-and-endtime/m-p/93710#M24133</guid>
      <dc:creator>tamasvincze</dc:creator>
      <dc:date>2020-09-28T14:21:27Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate response time from starttime and endtime</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-response-time-from-starttime-and-endtime/m-p/93711#M24134</link>
      <description>&lt;P&gt;Here is the faulty result:&lt;BR /&gt;
    UniqueID    earliest    latest&lt;BR /&gt;
1   3c126ec175261f75fcbc567c5c89751d    1373616006.561  1373616006.561&lt;BR /&gt;
2   3c34c5e2a32c8b1a7b853958207d223f    1373616006.561  1373616006.561&lt;BR /&gt;
3   7792eff1b42c35e7a208ffec68f63220    1373616006.546  1373616006.546&lt;BR /&gt;
4   d86dd547438271f2c5bc6c2bceb7e6f3    1373616006.561  1373616006.561&lt;/P&gt;

&lt;P&gt;Sorry, i had to post it in 2 comments, there wasn't enough character space in one.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jul 2013 11:09:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-response-time-from-starttime-and-endtime/m-p/93711#M24134</guid>
      <dc:creator>tamasvincze</dc:creator>
      <dc:date>2013-07-16T11:09:35Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate response time from starttime and endtime</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-response-time-from-starttime-and-endtime/m-p/93712#M24135</link>
      <description>&lt;P&gt;The transaction will have only one value for &lt;CODE&gt;_time&lt;/CODE&gt; because it's only one event, even though it consists of several previously individual events that have been merged.&lt;/P&gt;

&lt;P&gt;However &lt;CODE&gt;transaction&lt;/CODE&gt; will create a field called &lt;CODE&gt;duration&lt;/CODE&gt; that is exactly what it sounds like - the total duration of the transaction, in other words the time difference between the first and the last event in it.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jul 2013 11:20:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-response-time-from-starttime-and-endtime/m-p/93712#M24135</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2013-07-16T11:20:25Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate response time from starttime and endtime</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-response-time-from-starttime-and-endtime/m-p/93713#M24136</link>
      <description>&lt;P&gt;If you go the &lt;CODE&gt;stats&lt;/CODE&gt; route you won't need &lt;CODE&gt;transaction&lt;/CODE&gt; at all. Where you're going wrong is that you're trying to use BOTH the &lt;CODE&gt;transaction&lt;/CODE&gt; and the &lt;CODE&gt;stats&lt;/CODE&gt; option. Choose one.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jul 2013 11:21:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-response-time-from-starttime-and-endtime/m-p/93713#M24136</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2013-07-16T11:21:42Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate response time from starttime and endtime</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-response-time-from-starttime-and-endtime/m-p/93714#M24137</link>
      <description>&lt;P&gt;Thank you guys, it's working now.&lt;BR /&gt;
Have a good day!&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jul 2013 12:02:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-response-time-from-starttime-and-endtime/m-p/93714#M24137</guid>
      <dc:creator>tamasvincze</dc:creator>
      <dc:date>2013-07-16T12:02:55Z</dc:date>
    </item>
  </channel>
</rss>

