<?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: Average on a value over time in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Average-on-a-value-over-time/m-p/541835#M153438</link>
    <description>&lt;P&gt;Thank you for your response and sharing the information and approach.&lt;/P&gt;&lt;P&gt;Regarding point 1, I have posted the masked log and its rex below. I tested it on regex101.com: &lt;A href="https://regex101.com/r/p0MIAB/1" target="_blank"&gt;https://regex101.com/r/p0MIAB/1&lt;/A&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;2021-02-22 00:58:30,255 ERROR [com.xxx.yyy.interfaces.exception.web.ServerErrorController] (ajp-/100.10.100.100:8000-10) com.netflix.hystrix.exception.HystrixRuntimeException: Error message.&lt;/LI-CODE&gt;&lt;P&gt;rex: -&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;.*\w{8}-\w{4}-\w{4}-\w{4}-\w{12}\s*:\s*com.netflix.hystrix.exception.HystrixRuntimeException:\s*(?&amp;lt;error&amp;gt;.*?)\s*(\.|$)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regarding point 2, I executed the query for past 24 hours and observed it gave hourly count of errors from 22 February 2021 to 01 March 2021. I will try to work on this approach and build the query to get the results of last 24 hours along with it.&lt;/P&gt;</description>
    <pubDate>Mon, 01 Mar 2021 18:21:29 GMT</pubDate>
    <dc:creator>Taruchit</dc:creator>
    <dc:date>2021-03-01T18:21:29Z</dc:date>
    <item>
      <title>Average on a value over time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Average-on-a-value-over-time/m-p/22428#M3862</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have this data..&lt;/P&gt;

&lt;P&gt;Jul 31 23:17:54 83.231.181.65 Jul 31 23:17:54.861457 host1 INFO switch=switch0 [DATA] switchport=32 temp=37.8 &lt;BR /&gt;
Jul 31 23:17:54 83.231.181.65 Jul 31 23:17:54.861851 host1 INFO switch=switch1 [DATA] switchport=33 temp=41.2&lt;BR /&gt;
Jul 31 23:17:54 83.231.181.65 Jul 31 23:17:54.862236 host1 INFO switch=switch3 [DATA] switchport=11 temp=36&lt;/P&gt;

&lt;P&gt;I am trying to get the avg of the temp over time but failing&lt;/P&gt;

&lt;P&gt;I have tried using transaction but then it does not work over time as the data is now one event under a new "time"?&lt;/P&gt;

&lt;P&gt;I have tried using timechart but the span is incorrect and setting span=50us causes the indexer to hit 100%.&lt;/P&gt;

&lt;P&gt;| timechart avg(pdu_temp) span=50us&lt;/P&gt;

&lt;P&gt;Any ideas?&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jul 2012 22:38:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Average-on-a-value-over-time/m-p/22428#M3862</guid>
      <dc:creator>matthewparry</dc:creator>
      <dc:date>2012-07-31T22:38:20Z</dc:date>
    </item>
    <item>
      <title>Re: Average on a value over time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Average-on-a-value-over-time/m-p/22429#M3863</link>
      <description>&lt;P&gt;You want the average temperature over what time span? Would you like to see an average for each hour over the last 7 days? (ie, what is the average temp at 9 am, 10am, etc.) Would you like to see the average by day over the last 7 days?&lt;/P&gt;

&lt;P&gt;There are tons of ways to do this... although doing it by millisecond is probably not practical over any time span longer than 5 minutes...&lt;/P&gt;</description>
      <pubDate>Wed, 01 Aug 2012 00:13:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Average-on-a-value-over-time/m-p/22429#M3863</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2012-08-01T00:13:37Z</dc:date>
    </item>
    <item>
      <title>Re: Average on a value over time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Average-on-a-value-over-time/m-p/22430#M3864</link>
      <description>&lt;P&gt;Would you be able to give examples of seeing an average each hour?&lt;/P&gt;</description>
      <pubDate>Wed, 01 Aug 2012 08:08:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Average-on-a-value-over-time/m-p/22430#M3864</guid>
      <dc:creator>matthewparry</dc:creator>
      <dc:date>2012-08-01T08:08:32Z</dc:date>
    </item>
    <item>
      <title>Re: Average on a value over time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Average-on-a-value-over-time/m-p/22431#M3865</link>
      <description>&lt;P&gt;To answer my own question...&lt;/P&gt;

&lt;P&gt;| bucket _time span=5m | stats avg(temp) as Temperature by _time&lt;/P&gt;

&lt;P&gt;This groups the events into 5 min "buckets" and gets the average of the field, so it seems to do the trick.&lt;/P&gt;

&lt;P&gt;Is there a different/better way?&lt;/P&gt;</description>
      <pubDate>Wed, 01 Aug 2012 08:34:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Average-on-a-value-over-time/m-p/22431#M3865</guid>
      <dc:creator>matthewparry</dc:creator>
      <dc:date>2012-08-01T08:34:09Z</dc:date>
    </item>
    <item>
      <title>Re: Average on a value over time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Average-on-a-value-over-time/m-p/22432#M3866</link>
      <description>&lt;P&gt;Uhm, I don't see the reason for not using timechart?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | timechart span=5m avg(temp) as Temperature
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 01 Aug 2012 16:24:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Average-on-a-value-over-time/m-p/22432#M3866</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2012-08-01T16:24:37Z</dc:date>
    </item>
    <item>
      <title>Re: Average on a value over time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Average-on-a-value-over-time/m-p/22433#M3867</link>
      <description>&lt;P&gt;Because the avg in timechart take the last result, doesn't work over all result&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jan 2017 00:04:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Average-on-a-value-over-time/m-p/22433#M3867</guid>
      <dc:creator>inmzombie</dc:creator>
      <dc:date>2017-01-16T00:04:53Z</dc:date>
    </item>
    <item>
      <title>Re: Average on a value over time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Average-on-a-value-over-time/m-p/22434#M3868</link>
      <description>&lt;P&gt;Sorry, inmzombie, but you are wrong about that.&lt;BR /&gt;
The timechart command calculates the average temperature for each time range (in this case, time ranges are set to a 5-minute span).&lt;BR /&gt;
This is &lt;EM&gt;exactly&lt;/EM&gt; what the &lt;CODE&gt;| bucket _time span=5m | stats avg(temp) as Temperature by _time&lt;/CODE&gt; does.&lt;BR /&gt;
There is no difference.&lt;/P&gt;

&lt;P&gt;In both cases, you will get a series of averages with a timestamp.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2017 09:28:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Average-on-a-value-over-time/m-p/22434#M3868</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2017-01-18T09:28:45Z</dc:date>
    </item>
    <item>
      <title>Re: Average on a value over time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Average-on-a-value-over-time/m-p/540971#M153121</link>
      <description>&lt;P&gt;Hello Sir,&lt;/P&gt;&lt;P&gt;I am trying to calculate average results every hour for a week. The average is to be calculated on the rex field. I tried using the following but it did not worked:-&lt;/P&gt;&lt;P&gt;Method 1: |stats avg(error) as errors by _time&lt;/P&gt;&lt;P&gt;Method 2: |stats avg(error) as errors by date_hour&lt;/P&gt;&lt;P&gt;Method 3: |bucket _time span=1h |stats avg(error) as errors by date_hour&lt;/P&gt;&lt;P&gt;Thus, please help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Feb 2021 08:30:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Average-on-a-value-over-time/m-p/540971#M153121</guid>
      <dc:creator>Taruchit</dc:creator>
      <dc:date>2021-02-23T08:30:30Z</dc:date>
    </item>
    <item>
      <title>Re: Average on a value over time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Average-on-a-value-over-time/m-p/540974#M153123</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/223102"&gt;@Taruchit&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;did you tried with timechart command?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| timechart span=1h avg(error) as errors&lt;/LI-CODE&gt;&lt;P&gt;For more infos see at&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.1.2/SearchReference/Timechart" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/8.1.2/SearchReference/Timechart&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 23 Feb 2021 08:45:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Average-on-a-value-over-time/m-p/540974#M153123</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2021-02-23T08:45:00Z</dc:date>
    </item>
    <item>
      <title>Re: Average on a value over time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Average-on-a-value-over-time/m-p/541052#M153163</link>
      <description>&lt;P&gt;Hello Sir,&lt;/P&gt;&lt;P&gt;Thank you for your response. I tried using |timechart span=1h avg(error) as errors&lt;/P&gt;&lt;P&gt;I got a table with heading _time and errors.&lt;/P&gt;&lt;P&gt;Data under _time has date time with a gap of an hour. However, there is no data under column _time.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Feb 2021 17:29:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Average-on-a-value-over-time/m-p/541052#M153163</guid>
      <dc:creator>Taruchit</dc:creator>
      <dc:date>2021-02-23T17:29:50Z</dc:date>
    </item>
    <item>
      <title>Re: Average on a value over time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Average-on-a-value-over-time/m-p/541077#M153169</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/223102"&gt;@Taruchit&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;could you share your full search?&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 23 Feb 2021 20:04:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Average-on-a-value-over-time/m-p/541077#M153169</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2021-02-23T20:04:52Z</dc:date>
    </item>
    <item>
      <title>Re: Average on a value over time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Average-on-a-value-over-time/m-p/541325#M153263</link>
      <description>&lt;P&gt;Due to security reasons I won't be able to post the full query, but I will mask the content whereever needed.&amp;nbsp;&lt;/P&gt;&lt;P&gt;index="xxx" host=ap000*li source=xxx/xx.log AND GET OR POST AND "[xxx.xxx.xxx.xxx.*.*.*] (ajp-/*.*.*.*: 8089-*)" AND "com.netflix.hystrix.exception.HystrixRuntimeException" | rex ".*\w{8}-\w{4}-\w{4}-\w{4}-\w{12}\s*:\s*com.netflix.hystrix.exception.HystrixRuntimeException:\s*(?&amp;lt;error&amp;gt;.*?)\s*(\.|$)" | timechart span=1h avg(error) as errors&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also want to add some more points, when I tried running following query, I get count of errors in past 24 hours on hourly basis and count of errors during the same time window in previous week.&lt;/P&gt;&lt;P&gt;index="xxx" host=ap000*li source=xxx/xx.log AND GET OR POST AND "[xxx.xxx.xxx.xxx.*.*.*] (ajp-/*.*.*.*: 8089-*)" AND "com.netflix.hystrix.exception.HystrixRuntimeException" | rex ".*\w{8}-\w{4}-\w{4}-\w{4}-\w{12}\s*:\s*com.netflix.hystrix.exception. HystrixRuntimeException:\s(?&amp;lt;error&amp;gt;.*?)\s*(\.|$)"| chart count as error by date_hour |JOIN date_hour [search&amp;nbsp;index="xxx" host=ap000*li source=xxx/xx.log AND GET OR POST AND "[xxx.xxx.xxx.xxx.*.*.*] (ajp-/*.*.*.*: 8089-*)" AND "com.netflix.hystrix.exception.HystrixRuntimeException" (earliest=-7d@w1 latest=@w6) | rex ".*\w{8}-\w{4}-\w{4}-\w{4}-\w{12}\s*:\s*com.netflix.hystrix.exception.HystrixRuntimeException:\s*(?&amp;lt;error&amp;gt;.*?)\s*(\.|$)" | chart count as errors by date_hour] | table date_hour error errors |sort date_hour |rename error AS "In past 24 hours" |rename errors AS "In past 1 week"&lt;/P&gt;&lt;P&gt;If I run the query for past 24 hours today, it gives three columns:-&lt;/P&gt;&lt;P&gt;Column 1:-&lt;/P&gt;&lt;P&gt;date_hour: time window like 7,8, 9, 10...&lt;/P&gt;&lt;P&gt;Column 2:-&lt;/P&gt;&lt;P&gt;In past 24 hours: It gives count of errors on each row during time interval of 1 hour in past 24 hours.&lt;/P&gt;&lt;P&gt;Column 3:-&lt;/P&gt;&lt;P&gt;In past 1 week: It gives count of errors on each row during time interval of 1 hour in last week(15 February 2021 to 19 February 2021).&lt;/P&gt;</description>
      <pubDate>Thu, 25 Feb 2021 10:59:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Average-on-a-value-over-time/m-p/541325#M153263</guid>
      <dc:creator>Taruchit</dc:creator>
      <dc:date>2021-02-25T10:59:18Z</dc:date>
    </item>
    <item>
      <title>Re: Average on a value over time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Average-on-a-value-over-time/m-p/541517#M153321</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/223102"&gt;@Taruchit&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;about the first search, I cannot understand if the regex is corrected, could you share an example of your (also masqued!) logs?&lt;/P&gt;&lt;P&gt;Otherwise, you can test by yourself the regex on regex101.com&lt;/P&gt;&lt;P&gt;In addition, please insert your code in Code sample box (the button "&amp;lt;&amp;gt;" because I don't understand if the regex is readable.&lt;/P&gt;&lt;P&gt;At least try to escape the dots in the regex "&lt;SPAN&gt;com\.netflix\.hystrix\.exception\.HystrixRuntimeException".&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;About the second search, there aretwo problems:&lt;/SPAN&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;here's the limit of 50,000 results in subsearches so, you could not have all the results,&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;the join command is a very slow command, that's possible replace using only one search.&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN&gt;About try something like this (I cannot test it so I don't know if it runs, but see the approach:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="xxx" host=ap000*li source=xxx/xx.log (GET OR POST) "[xxx.xxx.xxx.xxx.*.*.*] (ajp-/*.*.*.*: 8089-*)" "com.netflix.hystrix.exception.HystrixRuntimeException" ((earliest=-24h@h latest=@h) OR (earliest=-7d@w1 latest=@w6))
| rex ".*\w{8}-\w{4}-\w{4}-\w{4}-\w{12}\s*:\s*com.netflix.hystrix.exception. HystrixRuntimeException:\s(?&amp;lt;error&amp;gt;.*?)\s*(\.|$)"
| eval week=if(_time-86400&amp;gt;0,"In past 24 hours", "In past 1 week")
| chart count as errors OVER week by date_hour&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 26 Feb 2021 14:08:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Average-on-a-value-over-time/m-p/541517#M153321</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2021-02-26T14:08:05Z</dc:date>
    </item>
    <item>
      <title>Re: Average on a value over time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Average-on-a-value-over-time/m-p/541835#M153438</link>
      <description>&lt;P&gt;Thank you for your response and sharing the information and approach.&lt;/P&gt;&lt;P&gt;Regarding point 1, I have posted the masked log and its rex below. I tested it on regex101.com: &lt;A href="https://regex101.com/r/p0MIAB/1" target="_blank"&gt;https://regex101.com/r/p0MIAB/1&lt;/A&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;2021-02-22 00:58:30,255 ERROR [com.xxx.yyy.interfaces.exception.web.ServerErrorController] (ajp-/100.10.100.100:8000-10) com.netflix.hystrix.exception.HystrixRuntimeException: Error message.&lt;/LI-CODE&gt;&lt;P&gt;rex: -&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;.*\w{8}-\w{4}-\w{4}-\w{4}-\w{12}\s*:\s*com.netflix.hystrix.exception.HystrixRuntimeException:\s*(?&amp;lt;error&amp;gt;.*?)\s*(\.|$)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regarding point 2, I executed the query for past 24 hours and observed it gave hourly count of errors from 22 February 2021 to 01 March 2021. I will try to work on this approach and build the query to get the results of last 24 hours along with it.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Mar 2021 18:21:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Average-on-a-value-over-time/m-p/541835#M153438</guid>
      <dc:creator>Taruchit</dc:creator>
      <dc:date>2021-03-01T18:21:29Z</dc:date>
    </item>
    <item>
      <title>Re: Average on a value over time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Average-on-a-value-over-time/m-p/541890#M153455</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/223102"&gt;@Taruchit&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;let me know if you solve your problem or if you need more help.&lt;/P&gt;&lt;P&gt;Ciao and happy splunking.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 02 Mar 2021 07:56:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Average-on-a-value-over-time/m-p/541890#M153455</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2021-03-02T07:56:53Z</dc:date>
    </item>
  </channel>
</rss>

