<?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 get an average value in timechart with time format? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-an-average-value-in-timechart-with-time-format/m-p/327346#M97481</link>
    <description>&lt;P&gt;Thanks @mayurr98 , its working&lt;/P&gt;</description>
    <pubDate>Mon, 29 Jan 2018 13:07:34 GMT</pubDate>
    <dc:creator>SapthagiriAavik</dc:creator>
    <dc:date>2018-01-29T13:07:34Z</dc:date>
    <item>
      <title>How to get an average value in timechart with time format?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-an-average-value-in-timechart-with-time-format/m-p/327337#M97472</link>
      <description>&lt;P&gt;I want  an average answering duration of each HR persons in hh:mm format&lt;BR /&gt;
&lt;CODE&gt;rep_duration&lt;/CODE&gt; is the time taken to answer and&lt;BR /&gt;
 search query is this &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=bora | timechart span=5d avg(rep_duration) as  AHT_avg  by hr_answerd
|eval hr=floor(AHT_avg/60)
|eval min=round(AHT_avg%60)
|strcat hr ":" min  AHT_avg
|fields - hr,min
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and expected output is this&lt;BR /&gt;
&lt;CODE&gt;hr_answered  date1  date2    date3   .....&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;name              hh:mm hh:mm  hh:mm ...&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;ex;&lt;BR /&gt;
hr_answerd 22/01/2018 23/01/2018&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;umesh 22:05 12:05
john 36:55 35:12
umesh 33:51 25:12
john 72:55 15:12
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 25 Jan 2018 18:36:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-an-average-value-in-timechart-with-time-format/m-p/327337#M97472</guid>
      <dc:creator>SapthagiriAavik</dc:creator>
      <dc:date>2018-01-25T18:36:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to get an average value in timechart with time format?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-an-average-value-in-timechart-with-time-format/m-p/327338#M97473</link>
      <description>&lt;P&gt;Try like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=bora | bucket span=5d _time | stats avg(rep_duration) as AHT_avg by _time hr_answered
| eval AHT_avg=tostring(AHT_avg, "duration")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 25 Jan 2018 18:52:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-an-average-value-in-timechart-with-time-format/m-p/327338#M97473</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2018-01-25T18:52:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to get an average value in timechart with time format?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-an-average-value-in-timechart-with-time-format/m-p/327339#M97474</link>
      <description>&lt;P&gt;Thank you for suggesstion, how to get only as hh:mm duration is showing  dd:hh:mm:ss&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jan 2018 20:07:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-an-average-value-in-timechart-with-time-format/m-p/327339#M97474</guid>
      <dc:creator>SapthagiriAavik</dc:creator>
      <dc:date>2018-01-25T20:07:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to get an average value in timechart with time format?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-an-average-value-in-timechart-with-time-format/m-p/327340#M97475</link>
      <description>&lt;P&gt;the format im looking for is &lt;/P&gt;

&lt;P&gt;hr_answerd  22/01/2018  23/01/2018&lt;BR /&gt;
umesh            22:05              12:05&lt;BR /&gt;
john               36:55               35:12&lt;BR /&gt;
umesh            33:51              25:12&lt;BR /&gt;
john                72:55              15:12&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jan 2018 20:16:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-an-average-value-in-timechart-with-time-format/m-p/327340#M97475</guid>
      <dc:creator>SapthagiriAavik</dc:creator>
      <dc:date>2018-01-25T20:16:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to get an average value in timechart with time format?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-an-average-value-in-timechart-with-time-format/m-p/327341#M97476</link>
      <description>&lt;P&gt;Change last eval to &lt;CODE&gt;| eval AHT_avg=strptime(strftime(AHT_avg, "%s"),"%H:%M")&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jan 2018 20:36:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-an-average-value-in-timechart-with-time-format/m-p/327341#M97476</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2018-01-25T20:36:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to get an average value in timechart with time format?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-an-average-value-in-timechart-with-time-format/m-p/327342#M97477</link>
      <description>&lt;P&gt;hey I think you want something like this &lt;/P&gt;

&lt;P&gt;try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=bora | bin span=1d _time | stats avg(rep_duration) as AHT_avg by _time hr_answered | eval AHT_avg=strftime(AHT_avg, "%s") | eval mins=floor((AHT_avg/60)%60) | eval hrs=floor((AHT_avg/3600)%60)
 | eval f_hrs=if(len(hrs)=1,"0".tostring(hrs), tostring(hrs))
 | eval f_mins=if(len(mins)=1,"0".tostring(mins), tostring(mins))  | eval result=f_hrs.":".f_mins | eval time=strftime(_time,"%d/%m/%Y") | chart values(result) over hr_answered by time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;adjust &lt;CODE&gt;| bin span=1d _time&lt;/CODE&gt; span according to your need.&lt;BR /&gt;
let me know if this helps!&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jan 2018 06:44:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-an-average-value-in-timechart-with-time-format/m-p/327342#M97477</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2018-01-26T06:44:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to get an average value in timechart with time format?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-an-average-value-in-timechart-with-time-format/m-p/327343#M97478</link>
      <description>&lt;P&gt;&lt;CODE&gt;| eval AHT_avg=strptime(strftime(AHT_avg, "%s"),"%H:%M")&lt;/CODE&gt; will give you no results as you are converting &lt;CODE&gt;AHT_avg&lt;/CODE&gt; to seconds and then to epoch time using &lt;CODE&gt;strptime&lt;/CODE&gt; giving the format of &lt;CODE&gt;%s&lt;/CODE&gt; to &lt;CODE&gt;%H:%M&lt;/CODE&gt; which is not possible. and even if you write &lt;CODE&gt;strftime&lt;/CODE&gt; it will give you false results. &lt;BR /&gt;
try this run anywhere search &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal total_k_processed=*  | bucket span=1d _time | stats avg(total_k_processed) as AHT_avg by _time name | eval z=strftime(strftime(AHT_avg, "%s"),"%H:%M")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I hope you understand what I am trying to say.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jan 2018 06:58:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-an-average-value-in-timechart-with-time-format/m-p/327343#M97478</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2018-01-26T06:58:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to get an average value in timechart with time format?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-an-average-value-in-timechart-with-time-format/m-p/327344#M97479</link>
      <description>&lt;P&gt;Thanks &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/172209"&gt;@mayurr98&lt;/a&gt;. Used wrong order of functions. &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/88222"&gt;@SapthagiriAavik&lt;/a&gt;ov, please use ´| eval AHT_avg=strftime(strptime(AHT_avg, "%s"),"%H:%M")´&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:51:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-an-average-value-in-timechart-with-time-format/m-p/327344#M97479</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2020-09-29T17:51:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to get an average value in timechart with time format?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-an-average-value-in-timechart-with-time-format/m-p/327345#M97480</link>
      <description>&lt;P&gt;you are welcome &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; , now &lt;CODE&gt;strftime&lt;/CODE&gt; will give you results but it will give you wrong results as it solely for time function so &lt;CODE&gt;%H&lt;/CODE&gt; can not be greater &lt;CODE&gt;24&lt;/CODE&gt; and in his case it could be anything like 30:50,35:40,36:55..so the only way to do this use eval function and convert it manually.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jan 2018 09:35:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-an-average-value-in-timechart-with-time-format/m-p/327345#M97480</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2018-01-26T09:35:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to get an average value in timechart with time format?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-an-average-value-in-timechart-with-time-format/m-p/327346#M97481</link>
      <description>&lt;P&gt;Thanks @mayurr98 , its working&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jan 2018 13:07:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-an-average-value-in-timechart-with-time-format/m-p/327346#M97481</guid>
      <dc:creator>SapthagiriAavik</dc:creator>
      <dc:date>2018-01-29T13:07:34Z</dc:date>
    </item>
  </channel>
</rss>

