<?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 Per day and Per second results not matching up. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Per-day-and-Per-second-results-not-matching-up/m-p/473778#M133313</link>
    <description>&lt;P&gt;I am running following queries to get event counts average per second and per day over a weeks period but the results makes no sense. &lt;/P&gt;

&lt;P&gt;This is the query to get average per day over a week: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=some_some2_idx ns=something app_name=my-api STATUS_CODE!=5*
| timechart span=1d count as requests_per_second | stats avg(requests_per_second)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The average per day result is 3010.5714285714284&lt;/P&gt;

&lt;P&gt;This is the query to get average per second over a week:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    index=some_some2_idx ns=something app_name=my-api STATUS_CODE!=5*
    | timechart span=1s count as requests_per_second | stats avg(requests_per_second)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The average per second result is 1.4238227146814404&lt;/P&gt;

&lt;P&gt;There are 86400 seconds in a day so 86400 * 1.4238227146814404 = 123018 and some change. I am not expecting an exact match but this is not even remotely close to 3010.5714285714284. What am I missing. Is this is expected or is there something wrong with my query? &lt;/P&gt;</description>
    <pubDate>Sun, 08 Sep 2019 20:16:48 GMT</pubDate>
    <dc:creator>angersleek</dc:creator>
    <dc:date>2019-09-08T20:16:48Z</dc:date>
    <item>
      <title>Per day and Per second results not matching up.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Per-day-and-Per-second-results-not-matching-up/m-p/473778#M133313</link>
      <description>&lt;P&gt;I am running following queries to get event counts average per second and per day over a weeks period but the results makes no sense. &lt;/P&gt;

&lt;P&gt;This is the query to get average per day over a week: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=some_some2_idx ns=something app_name=my-api STATUS_CODE!=5*
| timechart span=1d count as requests_per_second | stats avg(requests_per_second)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The average per day result is 3010.5714285714284&lt;/P&gt;

&lt;P&gt;This is the query to get average per second over a week:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    index=some_some2_idx ns=something app_name=my-api STATUS_CODE!=5*
    | timechart span=1s count as requests_per_second | stats avg(requests_per_second)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The average per second result is 1.4238227146814404&lt;/P&gt;

&lt;P&gt;There are 86400 seconds in a day so 86400 * 1.4238227146814404 = 123018 and some change. I am not expecting an exact match but this is not even remotely close to 3010.5714285714284. What am I missing. Is this is expected or is there something wrong with my query? &lt;/P&gt;</description>
      <pubDate>Sun, 08 Sep 2019 20:16:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Per-day-and-Per-second-results-not-matching-up/m-p/473778#M133313</guid>
      <dc:creator>angersleek</dc:creator>
      <dc:date>2019-09-08T20:16:48Z</dc:date>
    </item>
    <item>
      <title>Re: Per day and Per second results not matching up.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Per-day-and-Per-second-results-not-matching-up/m-p/473779#M133314</link>
      <description>&lt;P&gt;lets imagine, that you are looking over 2 days, and the grand total of events (count) is 100,000&lt;BR /&gt;
on your first query, you are counting events in each day, lets say, 60,000 in day 1 and 40,000 on day 2&lt;BR /&gt;
now you have 2 events, that you are averaging. in this case the average will be 50,000&lt;BR /&gt;
on the second query, you are breaking the total count of (100,00 0 in 2 days) to a count by second, meaning, you will have 100,000 events spread on 86,400 * 2 seconds, now you are averaging that.&lt;BR /&gt;
obviously, 100,000 / 172,800 (is less then 1) is far away from 50,000 and i hope the above example explains why.&lt;BR /&gt;
the main question is, what are you trying to report? what is the question you have on your data?&lt;BR /&gt;
let us know your question, and we will assist with writing the correct query&lt;/P&gt;</description>
      <pubDate>Mon, 09 Sep 2019 03:30:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Per-day-and-Per-second-results-not-matching-up/m-p/473779#M133314</guid>
      <dc:creator>adonio</dc:creator>
      <dc:date>2019-09-09T03:30:42Z</dc:date>
    </item>
    <item>
      <title>Re: Per day and Per second results not matching up.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Per-day-and-Per-second-results-not-matching-up/m-p/473780#M133315</link>
      <description>&lt;P&gt;Thanks for replying. All I am trying to do is to get a count on how many requests came in (which I believe is called events in this case) per second and per day based on each app_name (I am checking it over a week's period).   &lt;/P&gt;</description>
      <pubDate>Mon, 09 Sep 2019 08:33:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Per-day-and-Per-second-results-not-matching-up/m-p/473780#M133315</guid>
      <dc:creator>angersleek</dc:creator>
      <dc:date>2019-09-09T08:33:54Z</dc:date>
    </item>
    <item>
      <title>Re: Per day and Per second results not matching up.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Per-day-and-Per-second-results-not-matching-up/m-p/473781#M133316</link>
      <description>&lt;P&gt;in this case, you have to count the events per app, (app_name) and then divide by the amount of seconds to create the average with an &lt;CODE&gt;eval&lt;/CODE&gt; statement&lt;BR /&gt;
lets say you are counting events in 24 hours exactly, and you want the average for hour, minute and second:&lt;BR /&gt;
&lt;CODE&gt;earliest=-25h@h latest=-1h@h index =  sourcetype= ... all other filters here ... | stats count as event_count&lt;BR /&gt;
| rename COMMENT as "the above counts events in a 24 hours period"&lt;BR /&gt;
| eval average_per_hour = round(event_count / 60, 2)&lt;BR /&gt;
| eval average_per_minute = round(event_count / 3600,2)&lt;BR /&gt;
| eval average_per_second = round(event_count / 86400, 2)&lt;BR /&gt;
...&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;hope it helps&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 02:05:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Per-day-and-Per-second-results-not-matching-up/m-p/473781#M133316</guid>
      <dc:creator>adonio</dc:creator>
      <dc:date>2020-09-30T02:05:41Z</dc:date>
    </item>
  </channel>
</rss>

