<?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: Why is my search adding 18 hours to the value of my response time field? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-adding-18-hours-to-the-value-of-my-response/m-p/283034#M85522</link>
    <description>&lt;P&gt;Thanks @somesoni2 for answering this while I was away. You are extra helpful as always.&lt;/P&gt;</description>
    <pubDate>Sat, 24 Dec 2016 14:29:18 GMT</pubDate>
    <dc:creator>rjthibod</dc:creator>
    <dc:date>2016-12-24T14:29:18Z</dc:date>
    <item>
      <title>Why is my search adding 18 hours to the value of my response time field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-adding-18-hours-to-the-value-of-my-response/m-p/283027#M85515</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I am running a search to find out the response time using the below query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;mysearch | |eval diffResponse= ackTime - triggerTime 
|eval responseTime=strftime(diffResponse, "%H:%M:%S" )
|eval alertTriggerTime=strftime(triggerTime, "%b %d %H:%M:%S" )
|eval alertAckTime=strftime(ackTime, "%b %d %H:%M:%S" )
|eval ResponseMeanTime=strftime(ResponseMean, "%H:%M:%S" )
|table rule_id,alertTriggerTime,alertAckTime,responseTime
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;where ackTime and triggerTime are in epoch time. When this search is running, it is adding 18 hours to the value of responseTime. Attached the screenshot.&lt;/P&gt;

&lt;P&gt;Kindly help on this.&lt;BR /&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/2251iEAC7695D9C2E872C/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, 16 Dec 2016 08:19:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-adding-18-hours-to-the-value-of-my-response/m-p/283027#M85515</guid>
      <dc:creator>ksing</dc:creator>
      <dc:date>2016-12-16T08:19:51Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my search adding 18 hours to the value of my response time field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-adding-18-hours-to-the-value-of-my-response/m-p/283028#M85516</link>
      <description>&lt;P&gt;Per my recent post on this issue, &lt;A href="https://answers.splunk.com/answers/480763/why-am-i-unable-to-convert-a-duration-value-to-a-h.html#answer-481662"&gt;https://answers.splunk.com/answers/480763/why-am-i-unable-to-convert-a-duration-value-to-a-h.html#answer-481662&lt;/A&gt;, you are using the wrong eval function to generate the human readable form of the duration.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;strftime()&lt;/CODE&gt; expects a epoch time value. You need to use &lt;CODE&gt;tostring()&lt;/CODE&gt; on any fields that are time values not based on epoch time.  For example, replace your first eval with the following. You may need to do the same for your field "ResponseMeanTime".  calculated.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|eval responseTime= tostring(diffResponse, "duration")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So, the update search would be as follows, where I removed the "ResponseMeanTime" value since you don't appear to use it.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; mysearch | ...
 |eval diffResponse= ackTime - triggerTime 
 |eval responseTime=tostring(diffResponse, "duration" )
 |eval alertTriggerTime=strftime(triggerTime, "%b %d %H:%M:%S" )
 |eval alertAckTime=strftime(ackTime, "%b %d %H:%M:%S" )
 |table rule_id,alertTriggerTime,alertAckTime,responseTime
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 16 Dec 2016 12:30:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-adding-18-hours-to-the-value-of-my-response/m-p/283028#M85516</guid>
      <dc:creator>rjthibod</dc:creator>
      <dc:date>2016-12-16T12:30:39Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my search adding 18 hours to the value of my response time field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-adding-18-hours-to-the-value-of-my-response/m-p/283029#M85517</link>
      <description>&lt;P&gt;Thanks rjthibod for your assistance. When I was trying this &lt;/P&gt;

&lt;P&gt;I have created the below search for calculating the Response Mean time:&lt;/P&gt;

&lt;P&gt;| &lt;CODE&gt;incident_review&lt;/CODE&gt; |chart values(_time)  over rule_id by status_label |join rule_id [search &lt;CODE&gt;notable&lt;/CODE&gt; | search NOT &lt;CODE&gt;suppression&lt;/CODE&gt; owner!=unassigned| rename _time as triggerTime ] &lt;BR /&gt;
| rename "Resolved" as resolvedTime, "Closed" as closedTime "In Progress" as inProgressTime, "Pending" as pendingTime&lt;BR /&gt;
|eval ackTime = case(isnotnull(inProgressTime), inProgressTime, isnotnull(pendingTime), pendingTime, isnotnull(resolvedTime), resolvedTime, isnotnull(closedTime), closedTime, 1=1 , "Unassigned")&lt;BR /&gt;
|eval diffResponse= ackTime - triggerTime &lt;BR /&gt;
|eventstats avg(diffResponse) as ResponseMean&lt;BR /&gt;
|eval responseTime=strftime(diffResponse, "%H:%M:%S" ) &lt;BR /&gt;
|eval alertTriggerTime=strftime(triggerTime, "%b %d %H:%M:%S" )&lt;BR /&gt;
|eval alertAckTime=strftime(ackTime, "%b %d %H:%M:%S" )&lt;BR /&gt;
|eval ResponseMeanTime=strftime(ResponseMean, "%H:%M:%S" )&lt;BR /&gt;
|table rule_id,alertTriggerTime,alertAckTime,responseTime,ResponseMeanTime&lt;/P&gt;

&lt;P&gt;I have tried to use your query (|eval responseTime= tostring(diffResponse, "duration")), but I am unable to get the average value of Response time.&lt;/P&gt;

&lt;P&gt;Kindly assist on this.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 12:10:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-adding-18-hours-to-the-value-of-my-response/m-p/283029#M85517</guid>
      <dc:creator>ksing</dc:creator>
      <dc:date>2020-09-29T12:10:57Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my search adding 18 hours to the value of my response time field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-adding-18-hours-to-the-value-of-my-response/m-p/283030#M85518</link>
      <description>&lt;P&gt;I am a little confused.  Does the following search work? All I did was replace &lt;CODE&gt;strftime&lt;/CODE&gt; with &lt;CODE&gt;tostring&lt;/CODE&gt; for diffResponse and ResponseMean. I am a little perplexed if you are getting values in your previous search but not this one.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| incident_review |chart values(_time) over rule_id by status_label |join rule_id [search notable | search NOT suppression owner!=unassigned| rename _time as triggerTime ] 
| rename "Resolved" as resolvedTime, "Closed" as closedTime "In Progress" as inProgressTime, "Pending" as pendingTime
| eval ackTime = case(isnotnull(inProgressTime), inProgressTime, isnotnull(pendingTime), pendingTime, isnotnull(resolvedTime), resolvedTime, isnotnull(closedTime), closedTime, 1=1 , "Unassigned")
| eval diffResponse= ackTime - triggerTime 
| eventstats avg(diffResponse) as ResponseMean
| eval responseTime=tostring(diffResponse, "duration") 
| eval alertTriggerTime=strftime(triggerTime, "%b %d %H:%M:%S" )
| eval alertAckTime=strftime(ackTime, "%b %d %H:%M:%S" )
| eval ResponseMeanTime=tostring(ResponseMean, "duration")
| table rule_id,alertTriggerTime,alertAckTime,responseTime,ResponseMeanTime
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If the previous one does not work, what about this one? All it does is filter out places where the ackTime value is "unassigned" which would mess up your calculations in your original search if that is happening.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| incident_review |chart values(_time) over rule_id by status_label |join rule_id [search notable | search NOT suppression owner!=unassigned| rename _time as triggerTime ] 
| rename "Resolved" as resolvedTime, "Closed" as closedTime "In Progress" as inProgressTime, "Pending" as pendingTime
| eval ackTime = case(isnotnull(inProgressTime), inProgressTime, isnotnull(pendingTime), pendingTime, isnotnull(resolvedTime), resolvedTime, isnotnull(closedTime), closedTime, 1=1 , "Unassigned")
| search ackTime != "Unassigned"
| eval diffResponse= ackTime - triggerTime 
| eventstats avg(diffResponse) as ResponseMean
| eval responseTime=tostring(diffResponse, "duration") 
| eval alertTriggerTime=strftime(triggerTime, "%b %d %H:%M:%S" )
| eval alertAckTime=strftime(ackTime, "%b %d %H:%M:%S" )
| eval ResponseMeanTime=tostring(ResponseMean, "duration")
| table rule_id,alertTriggerTime,alertAckTime,responseTime,ResponseMeanTime
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 20 Dec 2016 12:54:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-adding-18-hours-to-the-value-of-my-response/m-p/283030#M85518</guid>
      <dc:creator>rjthibod</dc:creator>
      <dc:date>2016-12-20T12:54:56Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my search adding 18 hours to the value of my response time field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-adding-18-hours-to-the-value-of-my-response/m-p/283031#M85519</link>
      <description>&lt;P&gt;Thankyou, it works fine. The ResponseMeanTime shows in "HH:MM:SS.NNNNNNN" format, Is there any way to get the values in "HH:MM:SS" since I want to display the results as Dashboard for KPI.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Dec 2016 07:19:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-adding-18-hours-to-the-value-of-my-response/m-p/283031#M85519</guid>
      <dc:creator>ksing</dc:creator>
      <dc:date>2016-12-23T07:19:30Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my search adding 18 hours to the value of my response time field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-adding-18-hours-to-the-value-of-my-response/m-p/283032#M85520</link>
      <description>&lt;P&gt;Update the ResponseMeanTime eval with this.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval ResponseMeanTime=tostring(round(ResponseMean), "duration")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 23 Dec 2016 15:32:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-adding-18-hours-to-the-value-of-my-response/m-p/283032#M85520</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-12-23T15:32:38Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my search adding 18 hours to the value of my response time field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-adding-18-hours-to-the-value-of-my-response/m-p/283033#M85521</link>
      <description>&lt;P&gt;@ksing - Did the answer provided by rjthibod help provide a working solution to your question? If yes, please don't forget to resolve this post by clicking "Accept". If no, please leave a comment with more feedback. Don't forget to up vote any comments that were helpful. Thanks!&lt;/P&gt;</description>
      <pubDate>Sat, 24 Dec 2016 06:01:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-adding-18-hours-to-the-value-of-my-response/m-p/283033#M85521</guid>
      <dc:creator>aaraneta_splunk</dc:creator>
      <dc:date>2016-12-24T06:01:31Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my search adding 18 hours to the value of my response time field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-adding-18-hours-to-the-value-of-my-response/m-p/283034#M85522</link>
      <description>&lt;P&gt;Thanks @somesoni2 for answering this while I was away. You are extra helpful as always.&lt;/P&gt;</description>
      <pubDate>Sat, 24 Dec 2016 14:29:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-adding-18-hours-to-the-value-of-my-response/m-p/283034#M85522</guid>
      <dc:creator>rjthibod</dc:creator>
      <dc:date>2016-12-24T14:29:18Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my search adding 18 hours to the value of my response time field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-adding-18-hours-to-the-value-of-my-response/m-p/283035#M85523</link>
      <description>&lt;P&gt;thanks evenone for the great help. It was really helpful.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Dec 2016 05:17:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-adding-18-hours-to-the-value-of-my-response/m-p/283035#M85523</guid>
      <dc:creator>ksing</dc:creator>
      <dc:date>2016-12-26T05:17:17Z</dc:date>
    </item>
  </channel>
</rss>

