<?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 using streamstats and stats together in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/using-streamstats-and-stats-together/m-p/64932#M16036</link>
    <description>&lt;P&gt;i'd like to produce a field per event that's the running sum of some field as a percentage of the total sum of that field over the whole search.&lt;/P&gt;

&lt;P&gt;for example, if this were excel, my sheet would look something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;+-----------------------+---------------+-------------+
| original field values | running total | what i want |
+-----------------------+---------------+-------------+
|                     1 |             1 |         20% |
|                     1 |             2 |         40% |
|                     1 |             3 |         60% |
|                     1 |             4 |         80% |
|                     1 |             5 |        100% |
+-----------------------+---------------+-------------+
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;i see that &lt;EM&gt;streamstats&lt;/EM&gt; or &lt;EM&gt;accum&lt;/EM&gt; can generate my "running total" column,&lt;BR /&gt;
but to get my "what i want" column, i need the output of &lt;EM&gt;stats c()&lt;/EM&gt; or stats &lt;EM&gt;sum()&lt;/EM&gt;,&lt;BR /&gt;
which destroys the individual events.&lt;/P&gt;

&lt;P&gt;i feel like it might be a job for a sub-search and &lt;EM&gt;appendcols&lt;/EM&gt;, but i haven't been able to work it out.&lt;/P&gt;

&lt;P&gt;thanks in advance,&lt;BR /&gt;
orion&lt;/P&gt;</description>
    <pubDate>Sat, 04 Feb 2012 01:10:04 GMT</pubDate>
    <dc:creator>elenzil</dc:creator>
    <dc:date>2012-02-04T01:10:04Z</dc:date>
    <item>
      <title>using streamstats and stats together</title>
      <link>https://community.splunk.com/t5/Splunk-Search/using-streamstats-and-stats-together/m-p/64932#M16036</link>
      <description>&lt;P&gt;i'd like to produce a field per event that's the running sum of some field as a percentage of the total sum of that field over the whole search.&lt;/P&gt;

&lt;P&gt;for example, if this were excel, my sheet would look something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;+-----------------------+---------------+-------------+
| original field values | running total | what i want |
+-----------------------+---------------+-------------+
|                     1 |             1 |         20% |
|                     1 |             2 |         40% |
|                     1 |             3 |         60% |
|                     1 |             4 |         80% |
|                     1 |             5 |        100% |
+-----------------------+---------------+-------------+
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;i see that &lt;EM&gt;streamstats&lt;/EM&gt; or &lt;EM&gt;accum&lt;/EM&gt; can generate my "running total" column,&lt;BR /&gt;
but to get my "what i want" column, i need the output of &lt;EM&gt;stats c()&lt;/EM&gt; or stats &lt;EM&gt;sum()&lt;/EM&gt;,&lt;BR /&gt;
which destroys the individual events.&lt;/P&gt;

&lt;P&gt;i feel like it might be a job for a sub-search and &lt;EM&gt;appendcols&lt;/EM&gt;, but i haven't been able to work it out.&lt;/P&gt;

&lt;P&gt;thanks in advance,&lt;BR /&gt;
orion&lt;/P&gt;</description>
      <pubDate>Sat, 04 Feb 2012 01:10:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/using-streamstats-and-stats-together/m-p/64932#M16036</guid>
      <dc:creator>elenzil</dc:creator>
      <dc:date>2012-02-04T01:10:04Z</dc:date>
    </item>
    <item>
      <title>Re: using streamstats and stats together</title>
      <link>https://community.splunk.com/t5/Splunk-Search/using-streamstats-and-stats-together/m-p/64933#M16037</link>
      <description>&lt;P&gt;index=_internal  | head 5 | eval value=1 | eventstats sum(value) as total | streamstats window=0  sum(value) as sumvalue | eval percentage=(sumvalue*100/total) |  table value,sumvalue,total,percentage&lt;/P&gt;

&lt;P&gt;value   sumvalue    total   percentage&lt;BR /&gt;
1      1    5   20&lt;BR /&gt;
1   2   5   40&lt;BR /&gt;
1   3   5   60&lt;BR /&gt;
1   4   5   80&lt;BR /&gt;
1   5   5   100&lt;/P&gt;</description>
      <pubDate>Sun, 11 Jan 2015 18:37:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/using-streamstats-and-stats-together/m-p/64933#M16037</guid>
      <dc:creator>mzorzi</dc:creator>
      <dc:date>2015-01-11T18:37:47Z</dc:date>
    </item>
  </channel>
</rss>

