<?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: Getting Average Number of Requests Per Hour in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Getting-Average-Number-of-Requests-Per-Hour/m-p/73508#M18411</link>
    <description>&lt;P&gt;Yes, but if I increase the span to 1d shouldn't I then get the average count per hour? Or how does avg() know what time span I'm looking for?&lt;BR /&gt;
 (I meant to change the span to 1d)&lt;/P&gt;</description>
    <pubDate>Mon, 25 Mar 2013 17:42:46 GMT</pubDate>
    <dc:creator>ten_yard_fight</dc:creator>
    <dc:date>2013-03-25T17:42:46Z</dc:date>
    <item>
      <title>Getting Average Number of Requests Per Hour</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Getting-Average-Number-of-Requests-Per-Hour/m-p/73506#M18409</link>
      <description>&lt;P&gt;I've read most (if not all) of the questions/answers related to getting an average count of hits per hour. I've experimented with some of the queries posted by fellow splunkers and for the most part they've worked when using small queries (i.e. charting the two fields Total Count and Average Count . However, I've concocted a somewhat lengthy search query that doesn't seem to work correctly when trying to find the Average Request Per Hour (AvgReqPerHour) column. Let me show you what I have here. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | timechart span=1h count(status_code) AS Events,  count(eval(status_code&amp;gt;=200 AND status_code&amp;lt;=206)) AS SuccessfulRequests, count(eval(status_code&amp;gt;=300 AND status_code&amp;lt;=307)) AS RedirectedRequests, count(eval(status_code&amp;gt;=400 AND status_code &amp;lt;=505)) AS FailedRequests, dc(user_agent) AS TotalUsers, sum(file_size) AS TotalData, avg(file_size) AS AvgDataPerHour, avg(Events) AS AvgReqPerHour, avg(seconds) AS AvgResponseTimeSec
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So, this search should display some useful columns for finding web related stats. It counts all status codes and gives the number of requests by column and gives me averages for data transferred per hour and requests per hour.&lt;/P&gt;

&lt;P&gt;I hope someone else has done something similar and knows how to properly get the average requests per hour.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Mar 2013 16:33:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Getting-Average-Number-of-Requests-Per-Hour/m-p/73506#M18409</guid>
      <dc:creator>ten_yard_fight</dc:creator>
      <dc:date>2013-03-25T16:33:26Z</dc:date>
    </item>
    <item>
      <title>Re: Getting Average Number of Requests Per Hour</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Getting-Average-Number-of-Requests-Per-Hour/m-p/73507#M18410</link>
      <description>&lt;P&gt;Your field Events right at the top of the timechart is your requests per hour, no?&lt;/P&gt;</description>
      <pubDate>Mon, 25 Mar 2013 17:00:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Getting-Average-Number-of-Requests-Per-Hour/m-p/73507#M18410</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2013-03-25T17:00:13Z</dc:date>
    </item>
    <item>
      <title>Re: Getting Average Number of Requests Per Hour</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Getting-Average-Number-of-Requests-Per-Hour/m-p/73508#M18411</link>
      <description>&lt;P&gt;Yes, but if I increase the span to 1d shouldn't I then get the average count per hour? Or how does avg() know what time span I'm looking for?&lt;BR /&gt;
 (I meant to change the span to 1d)&lt;/P&gt;</description>
      <pubDate>Mon, 25 Mar 2013 17:42:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Getting-Average-Number-of-Requests-Per-Hour/m-p/73508#M18411</guid>
      <dc:creator>ten_yard_fight</dc:creator>
      <dc:date>2013-03-25T17:42:46Z</dc:date>
    </item>
    <item>
      <title>Re: Getting Average Number of Requests Per Hour</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Getting-Average-Number-of-Requests-Per-Hour/m-p/73509#M18412</link>
      <description>&lt;P&gt;No, avg() cannot predict what you had in mind. Take a look at per_hour().&lt;/P&gt;</description>
      <pubDate>Mon, 25 Mar 2013 17:45:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Getting-Average-Number-of-Requests-Per-Hour/m-p/73509#M18412</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2013-03-25T17:45:06Z</dc:date>
    </item>
    <item>
      <title>Re: Getting Average Number of Requests Per Hour</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Getting-Average-Number-of-Requests-Per-Hour/m-p/73510#M18413</link>
      <description>&lt;P&gt;How I interpret this, per_hour() only divides the total by hours in the span. That really isn't showing what the actual average is, right?&lt;/P&gt;</description>
      <pubDate>Mon, 25 Mar 2013 18:50:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Getting-Average-Number-of-Requests-Per-Hour/m-p/73510#M18413</guid>
      <dc:creator>ten_yard_fight</dc:creator>
      <dc:date>2013-03-25T18:50:14Z</dc:date>
    </item>
    <item>
      <title>Re: Getting Average Number of Requests Per Hour</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Getting-Average-Number-of-Requests-Per-Hour/m-p/73511#M18414</link>
      <description>&lt;P&gt;per_hour(foo) will sum up the values of foo for the bucket and then scale the sum as if the bucket were one hour long. If your bucket is ten minutes it will multiply by six, if your bucket is one day it will divide by 24.&lt;/P&gt;

&lt;P&gt;If every event in your data represents one hit you can do something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval reqs = 1 | timechart span=24h per_hour(reqs) as AvgReqPerHour ...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 25 Mar 2013 20:24:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Getting-Average-Number-of-Requests-Per-Hour/m-p/73511#M18414</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2013-03-25T20:24:58Z</dc:date>
    </item>
    <item>
      <title>Re: Getting Average Number of Requests Per Hour</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Getting-Average-Number-of-Requests-Per-Hour/m-p/73512#M18415</link>
      <description>&lt;P&gt;Awesome !! This is exactly what I was looking for. Your explanation put it into better perspective. Thank You.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Mar 2013 21:03:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Getting-Average-Number-of-Requests-Per-Hour/m-p/73512#M18415</guid>
      <dc:creator>ten_yard_fight</dc:creator>
      <dc:date>2013-03-25T21:03:55Z</dc:date>
    </item>
    <item>
      <title>Re: Getting Average Number of Requests Per Hour</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Getting-Average-Number-of-Requests-Per-Hour/m-p/73513#M18416</link>
      <description>&lt;P&gt;Great. I've converted the last comment to an answer so you can mark it as accepted.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2013 08:43:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Getting-Average-Number-of-Requests-Per-Hour/m-p/73513#M18416</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2013-03-26T08:43:58Z</dc:date>
    </item>
    <item>
      <title>Re: Getting Average Number of Requests Per Hour</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Getting-Average-Number-of-Requests-Per-Hour/m-p/73514#M18417</link>
      <description>&lt;P&gt;Wouldn't the simpler example below do the same thing?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | timechart count span=1h ...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The time span for the entire query could be set using the time picker. Seemed to work for my use case, at least. &lt;/P&gt;</description>
      <pubDate>Wed, 04 Feb 2015 20:44:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Getting-Average-Number-of-Requests-Per-Hour/m-p/73514#M18417</guid>
      <dc:creator>esset09</dc:creator>
      <dc:date>2015-02-04T20:44:50Z</dc:date>
    </item>
    <item>
      <title>Re: Getting Average Number of Requests Per Hour</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Getting-Average-Number-of-Requests-Per-Hour/m-p/73515#M18418</link>
      <description>&lt;P&gt;... | eval reqs = 1 | timechart span=24h per_hour(reqs) as AvgReqPerHour ...&lt;BR /&gt;
Working correctly for me, but the average calcul is wrong when I only have 6hours in a day for example.&lt;BR /&gt;
Does someone have an idea to only divided by available hours ? (6 for my example)&lt;/P&gt;</description>
      <pubDate>Thu, 09 Apr 2015 09:12:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Getting-Average-Number-of-Requests-Per-Hour/m-p/73515#M18418</guid>
      <dc:creator>collier31200</dc:creator>
      <dc:date>2015-04-09T09:12:12Z</dc:date>
    </item>
  </channel>
</rss>

