<?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 to calcuate the average response time in seconds for a field? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-calcuate-the-average-response-time-in-seconds-for-a-field/m-p/244183#M72694</link>
    <description>&lt;P&gt;Here is a sample log..&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;01/06 11:23:52.792 - 18.208 - 10.10.20.100:25640 - 8080 - "POST / HTTP/1.1" - 200 OK - 2336365 - 
01/06 11:23:26.549 - 1:16.000 - 10.10.20.100:25640 - 8080 - "POST / HTTP/1.1" - 200 OK - 987 - 
01/06 11:23:26.215 - 1:46.675 - 10.10.20.100:25640 - 8080 - "POST / HTTP/1.1" - 200 OK - 1650 - 
01/06 11:23:26.215 - 27.817 - 10.10.20.100:25640 - 8080 - "POST / HTTP/1.1" - 200 OK - 1650 -
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I am capturing full value in response_time field.&lt;/P&gt;</description>
    <pubDate>Fri, 20 Jan 2017 04:56:09 GMT</pubDate>
    <dc:creator>rajeshmeea21</dc:creator>
    <dc:date>2017-01-20T04:56:09Z</dc:date>
    <item>
      <title>How to calcuate the average response time in seconds for a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calcuate-the-average-response-time-in-seconds-for-a-field/m-p/244180#M72691</link>
      <description>&lt;P&gt;I am trying to calculate the average response time in seconds for one of my fields.&lt;BR /&gt;
Getting exception in result set.. Highlighted with value 1:16.000 and 1:46.675&lt;BR /&gt;
While calculating the average (avg) response time, i am not able to get these converted to seconds.&lt;/P&gt;

&lt;P&gt;Is there any workaround where i can calculate avg response time correctly? This field is a number.&lt;/P&gt;

&lt;P&gt;Below image will give you clearer idea.&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/2346i4C1141FA89A1E6A9/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2017 03:59:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calcuate-the-average-response-time-in-seconds-for-a-field/m-p/244180#M72691</guid>
      <dc:creator>rajeshmeea21</dc:creator>
      <dc:date>2017-01-20T03:59:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to calcuate the average response time in seconds for a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calcuate-the-average-response-time-in-seconds-for-a-field/m-p/244181#M72692</link>
      <description>&lt;P&gt;@rajeshmeea21 - It would be helpful if you were to provide your current search. The more information and context you can provide in your question, the better chance users in the Answers community can help provide you with a working solution. &lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2017 04:43:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calcuate-the-average-response-time-in-seconds-for-a-field/m-p/244181#M72692</guid>
      <dc:creator>aaraneta_splunk</dc:creator>
      <dc:date>2017-01-20T04:43:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to calcuate the average response time in seconds for a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calcuate-the-average-response-time-in-seconds-for-a-field/m-p/244182#M72693</link>
      <description>&lt;P&gt;Posting a sample event will help.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2017 04:45:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calcuate-the-average-response-time-in-seconds-for-a-field/m-p/244182#M72693</guid>
      <dc:creator>jagadeeshm</dc:creator>
      <dc:date>2017-01-20T04:45:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to calcuate the average response time in seconds for a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calcuate-the-average-response-time-in-seconds-for-a-field/m-p/244183#M72694</link>
      <description>&lt;P&gt;Here is a sample log..&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;01/06 11:23:52.792 - 18.208 - 10.10.20.100:25640 - 8080 - "POST / HTTP/1.1" - 200 OK - 2336365 - 
01/06 11:23:26.549 - 1:16.000 - 10.10.20.100:25640 - 8080 - "POST / HTTP/1.1" - 200 OK - 987 - 
01/06 11:23:26.215 - 1:46.675 - 10.10.20.100:25640 - 8080 - "POST / HTTP/1.1" - 200 OK - 1650 - 
01/06 11:23:26.215 - 27.817 - 10.10.20.100:25640 - 8080 - "POST / HTTP/1.1" - 200 OK - 1650 -
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I am capturing full value in response_time field.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2017 04:56:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calcuate-the-average-response-time-in-seconds-for-a-field/m-p/244183#M72694</guid>
      <dc:creator>rajeshmeea21</dc:creator>
      <dc:date>2017-01-20T04:56:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to calcuate the average response time in seconds for a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calcuate-the-average-response-time-in-seconds-for-a-field/m-p/244184#M72695</link>
      <description>&lt;P&gt;Sample logs:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;01/06 11:23:52.792 - 18.208 - 10.10.20.100:25640 - 8080 - "POST / HTTP/1.1" - 200 OK - 2336365 - 
01/06 11:23:26.549 - 1:16.000 - 10.10.20.100:25640 - 8080 - "POST / HTTP/1.1" - 200 OK - 987 - 
01/06 11:23:26.215 - 1:46.675 - 10.10.20.100:25640 - 8080 - "POST / HTTP/1.1" - 200 OK - 1650 - 
01/06 11:23:26.215 - 27.817 - 10.10.20.100:25640 - 8080 - "POST / HTTP/1.1" - 200 OK - 1650 -
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Search query:-&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=test | stats avg(response_time) by Module_Name
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 20 Jan 2017 05:03:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calcuate-the-average-response-time-in-seconds-for-a-field/m-p/244184#M72695</guid>
      <dc:creator>rajeshmeea21</dc:creator>
      <dc:date>2017-01-20T05:03:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to calcuate the average response time in seconds for a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calcuate-the-average-response-time-in-seconds-for-a-field/m-p/244185#M72696</link>
      <description>&lt;P&gt;If the current response times are in field called &lt;CODE&gt;response_time&lt;/CODE&gt; then can you please try to see if this works for you:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your query to return events
| rex field=response_time "^(?&amp;lt;myMinutes&amp;gt;[^\:]+)\:(?&amp;lt;mySeconds&amp;gt;.*)"
| eval myResponseTime=(myMinutes*60)+mySeconds
| eval response_time=coalesce(myResponseTime, response_time)
| stats avg(response_time) as AvgRespTimeInSec
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 20 Jan 2017 06:34:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calcuate-the-average-response-time-in-seconds-for-a-field/m-p/244185#M72696</guid>
      <dc:creator>gokadroid</dc:creator>
      <dc:date>2017-01-20T06:34:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to calcuate the average response time in seconds for a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calcuate-the-average-response-time-in-seconds-for-a-field/m-p/244186#M72697</link>
      <description>&lt;P&gt;Hi rajeshmeea21, &lt;/P&gt;

&lt;P&gt;I don't know how you calculated the response time field, but your log sample doesn't look right with the two exceptions. &lt;BR /&gt;
Assuming that you calculated your response duration by subtracting time of response and time of post, the duration should be converted into a time format: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;duration=tostring(post_time - response_time,"duration")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope this helps. Thanks!&lt;BR /&gt;
Hunter&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2017 06:37:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calcuate-the-average-response-time-in-seconds-for-a-field/m-p/244186#M72697</guid>
      <dc:creator>hunters_splunk</dc:creator>
      <dc:date>2017-01-20T06:37:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to calcuate the average response time in seconds for a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calcuate-the-average-response-time-in-seconds-for-a-field/m-p/244187#M72698</link>
      <description>&lt;P&gt;If I understand you correctly, like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex field=response_time "^(?&amp;lt;remainder&amp;gt;.*?)(?&amp;lt;seconds&amp;gt;[^:\s]+)$" 
| rex field=remainder "^(?&amp;lt;remainder&amp;gt;.*?)(?&amp;lt;minutes&amp;gt;[^:\s]+):$" 
| rex field=remainder "^(?&amp;lt;days&amp;gt;.*?)(?&amp;lt;hours&amp;gt;[^:\s]+):$" 
| rex field=days mode=sed "s/://" 
| fillnull value="0" days hours minutes seconds 
| eval days=if(len(days)=0, 0, days) | rename COMMENT AS "&amp;lt;-Bug fix for values like 2:3:4" 
| fields - remainder 
| eval response_time_seconds_only = seconds + 60 * (minutes + 60 * (hours + 24 * days))
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 20 Jan 2017 07:30:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calcuate-the-average-response-time-in-seconds-for-a-field/m-p/244187#M72698</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-01-20T07:30:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to calcuate the average response time in seconds for a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calcuate-the-average-response-time-in-seconds-for-a-field/m-p/244188#M72699</link>
      <description>&lt;P&gt;My solution is very similar but is extended for longer periods of time.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2017 19:43:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calcuate-the-average-response-time-in-seconds-for-a-field/m-p/244188#M72699</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-01-20T19:43:25Z</dc:date>
    </item>
  </channel>
</rss>

