<?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 Why does max value turn into average in my results for date range greater than 3 Days? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-does-max-value-turn-into-average-in-my-results-for-date/m-p/225546#M66506</link>
    <description>&lt;P&gt;So I have a query that is&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;| timechart count | timechart per_second(count) as TPS | timechart span=1d max (TPS)&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;This query results in the correct data out when ran on a single day or range of 2.&lt;/P&gt;

&lt;P&gt;However, if this query is ran for a time range that is greater than 2 days, the last "timechart span=1d max(TPS)" seems to become "timechart span=1d average(TPS)" instead. &lt;/P&gt;

&lt;P&gt;If you debug this by inspecting the evens individually the results below show that it's taking the average per day rather than the max.&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/1505i362E7D907BE13B8C/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;I confirmed that the value represented in the month report is the average by exporting the report for an individual day in excel and simply performing the average function on that column. &lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/1506i2CBCD8BD4D45B6DD/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 22 Jun 2016 20:08:46 GMT</pubDate>
    <dc:creator>mgrimes</dc:creator>
    <dc:date>2016-06-22T20:08:46Z</dc:date>
    <item>
      <title>Why does max value turn into average in my results for date range greater than 3 Days?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-max-value-turn-into-average-in-my-results-for-date/m-p/225546#M66506</link>
      <description>&lt;P&gt;So I have a query that is&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;| timechart count | timechart per_second(count) as TPS | timechart span=1d max (TPS)&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;This query results in the correct data out when ran on a single day or range of 2.&lt;/P&gt;

&lt;P&gt;However, if this query is ran for a time range that is greater than 2 days, the last "timechart span=1d max(TPS)" seems to become "timechart span=1d average(TPS)" instead. &lt;/P&gt;

&lt;P&gt;If you debug this by inspecting the evens individually the results below show that it's taking the average per day rather than the max.&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/1505i362E7D907BE13B8C/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;I confirmed that the value represented in the month report is the average by exporting the report for an individual day in excel and simply performing the average function on that column. &lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/1506i2CBCD8BD4D45B6DD/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jun 2016 20:08:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-max-value-turn-into-average-in-my-results-for-date/m-p/225546#M66506</guid>
      <dc:creator>mgrimes</dc:creator>
      <dc:date>2016-06-22T20:08:46Z</dc:date>
    </item>
    <item>
      <title>Re: Why does max value turn into average in my results for date range greater than 3 Days?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-max-value-turn-into-average-in-my-results-for-date/m-p/225547#M66507</link>
      <description>&lt;P&gt;Give this a try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search  | timechart span=1s count as TPS | timechart span=1d max(TPS)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Jun 2016 20:23:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-max-value-turn-into-average-in-my-results-for-date/m-p/225547#M66507</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-06-22T20:23:20Z</dc:date>
    </item>
    <item>
      <title>Re: Why does max value turn into average in my results for date range greater than 3 Days?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-max-value-turn-into-average-in-my-results-for-date/m-p/225548#M66508</link>
      <description>&lt;P&gt;_time              max(TPS)&lt;BR /&gt;
2016-05-01&lt;BR /&gt;&lt;BR /&gt;
2016-05-02     677&lt;BR /&gt;
2016-05-03     705&lt;/P&gt;

&lt;P&gt;The results so far seem to be the max total number of events of a given day&lt;/P&gt;

&lt;P&gt;However, I'm attempting to find the max number of events per second per day. &lt;/P&gt;</description>
      <pubDate>Wed, 22 Jun 2016 20:32:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-max-value-turn-into-average-in-my-results-for-date/m-p/225548#M66508</guid>
      <dc:creator>mgrimes</dc:creator>
      <dc:date>2016-06-22T20:32:34Z</dc:date>
    </item>
    <item>
      <title>Re: Why does max value turn into average in my results for date range greater than 3 Days?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-max-value-turn-into-average-in-my-results-for-date/m-p/225549#M66509</link>
      <description>&lt;P&gt;That's strange. Could just run the first timechart (with span=1s) and see what is the type (in magniture) of values that you get?&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jun 2016 21:14:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-max-value-turn-into-average-in-my-results-for-date/m-p/225549#M66509</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-06-22T21:14:43Z</dc:date>
    </item>
    <item>
      <title>Re: Why does max value turn into average in my results for date range greater than 3 Days?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-max-value-turn-into-average-in-my-results-for-date/m-p/225550#M66510</link>
      <description>&lt;P&gt;Query: &lt;CODE&gt;cs_host="services*" OR cs_host="lookup*" | timechart span=1s count&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Results: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;_time   count
2016-05-03 21:34:10 17
2016-05-03 21:34:11 10
2016-05-03 21:34:12 18
2016-05-03 21:34:13 15
2016-05-03 21:34:14 19
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hopefully I ran the query that you suggested. It seems to return the correct number of queries per second&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jun 2016 16:55:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-max-value-turn-into-average-in-my-results-for-date/m-p/225550#M66510</guid>
      <dc:creator>mgrimes</dc:creator>
      <dc:date>2016-06-23T16:55:26Z</dc:date>
    </item>
    <item>
      <title>Re: Why does max value turn into average in my results for date range greater than 3 Days?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-max-value-turn-into-average-in-my-results-for-date/m-p/225551#M66511</link>
      <description>&lt;P&gt;THis looks promising. Can you try this now&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;cs_host="services*" OR cs_host="lookup*" | timechart span=1s count | timechart span=1d max(count) as max_TPS
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;AND&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;cs_host="services*" OR cs_host="lookup*" | timechart span=1s count | bucket span=1d _time | stats max(count) as max_TPS by _time
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 23 Jun 2016 17:54:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-max-value-turn-into-average-in-my-results-for-date/m-p/225551#M66511</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-06-23T17:54:11Z</dc:date>
    </item>
    <item>
      <title>Re: Why does max value turn into average in my results for date range greater than 3 Days?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-max-value-turn-into-average-in-my-results-for-date/m-p/225552#M66512</link>
      <description>&lt;P&gt;Results for: &lt;CODE&gt;cs_host="services*" OR cs_host="lookup*" | timechart span=1s count | timechart span=1d max(count) as max_TPS&lt;BR /&gt;
&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;_time   max_TPS
2016-05-01   
2016-05-02  677
2016-05-03  705
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Results for &lt;CODE&gt;cs_host="services*" OR cs_host="lookup*" | timechart span=1s count | bucket span=1d _time | stats max(count) as max_TPS by _time&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;_time   max_TPS
2016-05-02 00:00:00 677
2016-05-03 00:00:00 705
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Like before they seem to just take the total of the average per second. I changed the data range from 3 days to 2 to check if anything is changing but it's consistent with finding the totals&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jun 2016 18:09:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-max-value-turn-into-average-in-my-results-for-date/m-p/225552#M66512</guid>
      <dc:creator>mgrimes</dc:creator>
      <dc:date>2016-06-23T18:09:45Z</dc:date>
    </item>
    <item>
      <title>Re: Why does max value turn into average in my results for date range greater than 3 Days?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-max-value-turn-into-average-in-my-results-for-date/m-p/225553#M66513</link>
      <description>&lt;P&gt;I don't see any issue with query, but could be the data is like that. So, let verify that. Please run this query and let me know result.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;cs_host="services*" OR cs_host="lookup*" | timechart span=1s count | eval Date=strftime(_time,"%m/%d/%Y")  | eventstats max(count) as max_TPS by Date | where count=max_TPS
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 23 Jun 2016 18:17:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-max-value-turn-into-average-in-my-results-for-date/m-p/225553#M66513</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-06-23T18:17:26Z</dc:date>
    </item>
    <item>
      <title>Re: Why does max value turn into average in my results for date range greater than 3 Days?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-max-value-turn-into-average-in-my-results-for-date/m-p/225554#M66514</link>
      <description>&lt;P&gt;Results:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;_time   count   Date    max_TPS
2016-05-01 20:27:22 923 05/01/2016  923
2016-05-02 03:13:13 796 05/02/2016  796
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 23 Jun 2016 18:31:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-max-value-turn-into-average-in-my-results-for-date/m-p/225554#M66514</guid>
      <dc:creator>mgrimes</dc:creator>
      <dc:date>2016-06-23T18:31:24Z</dc:date>
    </item>
    <item>
      <title>Re: Why does max value turn into average in my results for date range greater than 3 Days?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-max-value-turn-into-average-in-my-results-for-date/m-p/225555#M66515</link>
      <description>&lt;P&gt;You can probably increase the limit but again, since you're looking for  1 second bucket, the new limit will again get hit for larger period. This is a classic use-case for summary indexing. What you  should do is to create a scheduler search to run at an interval and look at data for same period as the interval and save the summary in a summary index. You search that should refer to already summarized data from the summary index. &lt;/P&gt;

&lt;P&gt;I would recommend you to go through following and setup that.&lt;/P&gt;

&lt;P&gt;&lt;A href="https://wiki.splunk.com/Community:Summary_Indexing"&gt;https://wiki.splunk.com/Community:Summary_Indexing&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.3.0/Knowledge/Configuresummaryindexes"&gt;http://docs.splunk.com/Documentation/Splunk/6.3.0/Knowledge/Configuresummaryindexes&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.3.0/Knowledge/Usesummaryindexing"&gt;http://docs.splunk.com/Documentation/Splunk/6.3.0/Knowledge/Usesummaryindexing&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jun 2016 18:38:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-max-value-turn-into-average-in-my-results-for-date/m-p/225555#M66515</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-06-23T18:38:57Z</dc:date>
    </item>
    <item>
      <title>Re: Why does max value turn into average in my results for date range greater than 3 Days?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-max-value-turn-into-average-in-my-results-for-date/m-p/225556#M66516</link>
      <description>&lt;P&gt;Regarding your data values, could you just search for events at the time mentioned in the result and check if there really are that many events OR not for that minute.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jun 2016 18:39:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-max-value-turn-into-average-in-my-results-for-date/m-p/225556#M66516</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-06-23T18:39:58Z</dc:date>
    </item>
    <item>
      <title>Re: Why does max value turn into average in my results for date range greater than 3 Days?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-max-value-turn-into-average-in-my-results-for-date/m-p/225557#M66517</link>
      <description>&lt;P&gt;So it seems that there are that many events for that particular second so it seems that your query is correct to being with. I also saw that it started with 40-50 until it spiked to 600+ which is possible for our production traffic on occasion. &lt;/P&gt;

&lt;P&gt;This means that I was misreading my query from the start&lt;BR /&gt;
    cs_host="services*" OR cs_host="lookup*" | timechart count | timechart per_second(count)&lt;/P&gt;

&lt;P&gt;I was under the assumption this was correct for finding the events per second, however it seems to be taking the average of some sort base off the results. It is also spaced by 30 minutes.  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;_time   per_second(count)
2016-06-23 09:00:00 21.842778
2016-06-23 09:30:00 22.245000
2016-06-23 10:00:00 23.039444
2016-06-23 10:30:00 23.239444
2016-06-23 11:00:00 26.157222
2016-06-23 11:30:00 22.617778
2016-06-23 12:00:00 22.279444
2016-06-23 12:30:00 22.024444
2016-06-23 13:00:00 23.281667
2016-06-23 13:30:00 21.914444
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;For this particular query that you have provided &lt;CODE&gt;cs_host="services*" OR cs_host="lookup*" | timechart span=1s count | eval Date=strftime(_time,"%m/%d/%Y")  | eventstats max(count) as max_TPS by Date | where count=max_TPS&lt;/CODE&gt; is there a way for me to exclude this outliers easily with a conditional statement? I am still fairly new with Splunk syntax &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 10:02:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-max-value-turn-into-average-in-my-results-for-date/m-p/225557#M66517</guid>
      <dc:creator>mgrimes</dc:creator>
      <dc:date>2020-09-29T10:02:37Z</dc:date>
    </item>
    <item>
      <title>Re: Why does max value turn into average in my results for date range greater than 3 Days?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-max-value-turn-into-average-in-my-results-for-date/m-p/225558#M66518</link>
      <description>&lt;P&gt;We sure can. &lt;/P&gt;

&lt;P&gt;Here I'm excluding counts where are 50% or more of the max value for the day. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;cs_host="services*" OR cs_host="lookup*" | timechart span=1s count | eval Date=strftime(_time,"%m/%d/%Y") | eventstats max(count) as max_TPS by Date | where count&amp;lt;max_TPS*0.5 | timechart span=1d max(count) as TPS
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;OR&lt;BR /&gt;
Here I calculated the max_TPS as the 95 percentile value so those 5% of outliers should get filtered&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;cs_host="services*" OR cs_host="lookup*" | timechart span=1s count | eval Date=strftime(_time,"%m/%d/%Y") | eventstats perc95(count) as max_TPS by Date | where count&amp;lt;max_TPS | timechart span=1d max(count) as TPS
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 24 Jun 2016 14:32:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-max-value-turn-into-average-in-my-results-for-date/m-p/225558#M66518</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-06-24T14:32:29Z</dc:date>
    </item>
    <item>
      <title>Re: Why does max value turn into average in my results for date range greater than 3 Days?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-max-value-turn-into-average-in-my-results-for-date/m-p/225559#M66519</link>
      <description>&lt;P&gt;Thank you for all your help. I really appreciate all the work you did with solving my issue and debugging!&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jun 2016 19:03:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-max-value-turn-into-average-in-my-results-for-date/m-p/225559#M66519</guid>
      <dc:creator>mgrimes</dc:creator>
      <dc:date>2016-06-24T19:03:40Z</dc:date>
    </item>
  </channel>
</rss>

