<?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 Counting Events and then finding the sum? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Counting-Events-and-then-finding-the-sum/m-p/204489#M59397</link>
    <description>&lt;P&gt;Good Morning, Fellow Splunkers&lt;/P&gt;

&lt;P&gt;I'm interested in counting events per hour for a 24 hr period.  I would also like to have a sum total count for the end of the period. So within that hour how many alerts have been generated?  &lt;/P&gt;

&lt;P&gt;Time      Alert &lt;BR /&gt;
1h.............3&lt;BR /&gt;
2h.............3&lt;BR /&gt;
3h.............2&lt;BR /&gt;
4h.............2&lt;BR /&gt;
5h.............9&lt;BR /&gt;
.&lt;BR /&gt;
.&lt;BR /&gt;
.&lt;BR /&gt;
.&lt;BR /&gt;
24h............(19)    Sum &lt;/P&gt;

&lt;P&gt;My search Query:&lt;BR /&gt;
index=* host=* myalert=* |timechart span=1h count by host&lt;/P&gt;</description>
    <pubDate>Thu, 03 Nov 2016 14:57:21 GMT</pubDate>
    <dc:creator>asarran</dc:creator>
    <dc:date>2016-11-03T14:57:21Z</dc:date>
    <item>
      <title>Counting Events and then finding the sum?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Counting-Events-and-then-finding-the-sum/m-p/204489#M59397</link>
      <description>&lt;P&gt;Good Morning, Fellow Splunkers&lt;/P&gt;

&lt;P&gt;I'm interested in counting events per hour for a 24 hr period.  I would also like to have a sum total count for the end of the period. So within that hour how many alerts have been generated?  &lt;/P&gt;

&lt;P&gt;Time      Alert &lt;BR /&gt;
1h.............3&lt;BR /&gt;
2h.............3&lt;BR /&gt;
3h.............2&lt;BR /&gt;
4h.............2&lt;BR /&gt;
5h.............9&lt;BR /&gt;
.&lt;BR /&gt;
.&lt;BR /&gt;
.&lt;BR /&gt;
.&lt;BR /&gt;
24h............(19)    Sum &lt;/P&gt;

&lt;P&gt;My search Query:&lt;BR /&gt;
index=* host=* myalert=* |timechart span=1h count by host&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2016 14:57:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Counting-Events-and-then-finding-the-sum/m-p/204489#M59397</guid>
      <dc:creator>asarran</dc:creator>
      <dc:date>2016-11-03T14:57:21Z</dc:date>
    </item>
    <item>
      <title>Re: Counting Events and then finding the sum?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Counting-Events-and-then-finding-the-sum/m-p/204490#M59398</link>
      <description>&lt;P&gt;Something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index= host= myalert=* |timechart span=1h count by host | addcoltotals
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 03 Nov 2016 15:00:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Counting-Events-and-then-finding-the-sum/m-p/204490#M59398</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-11-03T15:00:12Z</dc:date>
    </item>
    <item>
      <title>Re: Counting Events and then finding the sum?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Counting-Events-and-then-finding-the-sum/m-p/204491#M59399</link>
      <description>&lt;P&gt;Give this a shot, it will give you the counts per hour and an extra row to sum up the total of the day:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats count WHERE index=_internal GROUPBY _time span=1h
| appendpipe [timechart span=24h sum(count) as total]
| sort _time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you don't want to use tstats (which can be up to 1000x times faster than a regular search) you can do this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal 
| timechart span=1h count
| appendpipe [timechart span=24h sum(count) as total]
| sort _time
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 03 Nov 2016 15:25:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Counting-Events-and-then-finding-the-sum/m-p/204491#M59399</guid>
      <dc:creator>gwobben</dc:creator>
      <dc:date>2016-11-03T15:25:26Z</dc:date>
    </item>
  </channel>
</rss>

