<?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: stats for a given time range for last 30 days in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/stats-for-a-given-time-range-for-last-30-days/m-p/93805#M24148</link>
    <description>&lt;P&gt;that's one of doing it.&lt;/P&gt;

&lt;P&gt;I would suggest building it as follows:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;specify fields earliest,latest to narrow the range&lt;/LI&gt;
&lt;LI&gt;use the where command to limit the start/end times of each day, further narrowing your dataset&lt;/LI&gt;
&lt;LI&gt;apply the stats command across that range&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;for example &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;
earliest=-31d latest=-1d | where strftime(_time, "%H") &amp;gt; "18" AND strftime(_time, "%H") &amp;lt; "21" | stats count(FIELD) over _time&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 12:02:40 GMT</pubDate>
    <dc:creator>ak</dc:creator>
    <dc:date>2020-09-28T12:02:40Z</dc:date>
    <item>
      <title>stats for a given time range for last 30 days</title>
      <link>https://community.splunk.com/t5/Splunk-Search/stats-for-a-given-time-range-for-last-30-days/m-p/93804#M24147</link>
      <description>&lt;P&gt;I would like to get an average of a any given value for a time range say 7:00 PM to 8:00 PM over last 30 days.&lt;/P&gt;

&lt;P&gt;Would I need to use sum(eval(if(_Time &amp;gt;= StartTime,if (_time&amp;lt;=EndTime,ValueToSum,0),0) and then calculate the average?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 12:02:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/stats-for-a-given-time-range-for-last-30-days/m-p/93804#M24147</guid>
      <dc:creator>adoshi</dc:creator>
      <dc:date>2020-09-28T12:02:35Z</dc:date>
    </item>
    <item>
      <title>Re: stats for a given time range for last 30 days</title>
      <link>https://community.splunk.com/t5/Splunk-Search/stats-for-a-given-time-range-for-last-30-days/m-p/93805#M24148</link>
      <description>&lt;P&gt;that's one of doing it.&lt;/P&gt;

&lt;P&gt;I would suggest building it as follows:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;specify fields earliest,latest to narrow the range&lt;/LI&gt;
&lt;LI&gt;use the where command to limit the start/end times of each day, further narrowing your dataset&lt;/LI&gt;
&lt;LI&gt;apply the stats command across that range&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;for example &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;
earliest=-31d latest=-1d | where strftime(_time, "%H") &amp;gt; "18" AND strftime(_time, "%H") &amp;lt; "21" | stats count(FIELD) over _time&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 12:02:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/stats-for-a-given-time-range-for-last-30-days/m-p/93805#M24148</guid>
      <dc:creator>ak</dc:creator>
      <dc:date>2020-09-28T12:02:40Z</dc:date>
    </item>
    <item>
      <title>Re: stats for a given time range for last 30 days</title>
      <link>https://community.splunk.com/t5/Splunk-Search/stats-for-a-given-time-range-for-last-30-days/m-p/93806#M24149</link>
      <description>&lt;P&gt;Thank you.  I am planning to use this in a monitoring scenario so if error counts in last 30 minutes increase more than the 30 day average (during the same 30 minutes) then we have a problem.  So would you recommend sticking to rounded 30 minutes or do last 30 minutes?&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jul 2012 21:19:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/stats-for-a-given-time-range-for-last-30-days/m-p/93806#M24149</guid>
      <dc:creator>adoshi</dc:creator>
      <dc:date>2012-07-09T21:19:32Z</dc:date>
    </item>
  </channel>
</rss>

