<?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 data by _time in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-data-by-time/m-p/552526#M156844</link>
    <description>&lt;P&gt;What do your two searches look like?&lt;/P&gt;</description>
    <pubDate>Fri, 21 May 2021 07:58:00 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2021-05-21T07:58:00Z</dc:date>
    <item>
      <title>How to get data by _time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-data-by-time/m-p/552190#M156701</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=xyz source="something"
|stats earliest(_time) as minTime latest(_time) as maxTime values(activityName) as activityName values(accessSeekerId) as accessSeekerId values(businessChannel) as businessChannel values(status) as status values(ttStatus) as ttStatus values(feature) as feature by requestId
| eval duration = maxTime - minTime 
| stats avg(duration) AS "AvgResponseTime" perc95(duration) AS "P95ResponseTime"&lt;/LI-CODE&gt;&lt;P&gt;If I run this script for a day&amp;nbsp; then I get some non-zero value for AvgResponseTime and P95ResponseTime also get different values for minTime and maxTime.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But if i run following script for same time, I get same values for&amp;nbsp;minTime&amp;nbsp; and&amp;nbsp;maxTime.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=xyz source="something" 
|bin _time span=1d
|stats earliest(_time) as minTime latest(_time) as maxTime values(activityName) as activityName values(accessSeekerId) as accessSeekerId values(businessChannel) as businessChannel values(status) as status values(ttStatus) as ttStatus values(feature) as feature by requestId _time
| eval duration = maxTime - minTime 
|| eval Time=strftime(_time , "%d/%m/%Y %H:%M") 
| stats avg(duration) AS "AvgResponseTime" perc95(duration) AS "P95ResponseTime" by Time&lt;/LI-CODE&gt;&lt;P&gt;At the end I get 0 for AvgResponseTime and P95ResponseTime which is not matching with above query as value of duration gets as 0.&lt;/P&gt;&lt;P&gt;I want output of based on each day AvgResponseTime and&amp;nbsp;P95ResponseTime&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope I give clear idea about my issue. What would I do to resolve this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 May 2021 11:32:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-data-by-time/m-p/552190#M156701</guid>
      <dc:creator>Learner</dc:creator>
      <dc:date>2021-05-19T11:32:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to get data by _time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-data-by-time/m-p/552191#M156702</link>
      <description>&lt;P&gt;bin will set all the times to the beginning of the day, so when you do stats by the same field, they will all be the same - hence 0 duration. Use bin to set up a different field (day) and do stats by that, thus leaving _time undisturbed&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=xyz source="something" 
|bin _time span=1d as day
|stats earliest(_time) as minTime latest(_time) as maxTime values(activityName) as activityName values(accessSeekerId) as accessSeekerId values(businessChannel) as businessChannel values(status) as status values(ttStatus) as ttStatus values(feature) as feature by requestId day
| eval duration = maxTime - minTime 
|| eval Time=strftime(day, "%d/%m/%Y %H:%M") 
| stats avg(duration) AS "AvgResponseTime" perc95(duration) AS "P95ResponseTime" by Time&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 19 May 2021 11:37:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-data-by-time/m-p/552191#M156702</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-05-19T11:37:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to get data by _time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-data-by-time/m-p/552520#M156840</link>
      <description>&lt;P&gt;thank you very much&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;. it solved some part of my problem. i checked the values for&amp;nbsp;"AvgResponseTime" and "P95ResponseTime" and they are not matching. Suppose i ran my code without filtering _time, i get values as 0.4 and 1.7 to&amp;nbsp;"AvgResponseTime" and "P95ResponseTime" respectively. but if i use your code i get average values of&amp;nbsp; "AvgResponseTime" and "P95ResponseTime"&amp;nbsp; as 0.4 and 1.9 respectively. why is that so? and how to solve this?&lt;/P&gt;&lt;P&gt;thanks, in advance!&lt;/P&gt;</description>
      <pubDate>Fri, 21 May 2021 07:35:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-data-by-time/m-p/552520#M156840</guid>
      <dc:creator>Learner</dc:creator>
      <dc:date>2021-05-21T07:35:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to get data by _time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-data-by-time/m-p/552526#M156844</link>
      <description>&lt;P&gt;What do your two searches look like?&lt;/P&gt;</description>
      <pubDate>Fri, 21 May 2021 07:58:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-data-by-time/m-p/552526#M156844</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-05-21T07:58:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to get data by _time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-data-by-time/m-p/553110#M157008</link>
      <description>&lt;P&gt;Query which I specified, is my actual query.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 May 2021 10:13:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-data-by-time/m-p/553110#M157008</guid>
      <dc:creator>Learner</dc:creator>
      <dc:date>2021-05-26T10:13:11Z</dc:date>
    </item>
  </channel>
</rss>

