<?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 is Streamstats not working ? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/why-is-Streamstats-not-working/m-p/145553#M40580</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I am trying to find cumulative sum of unique &lt;CODE&gt;IPAddress&lt;/CODE&gt; by &lt;CODE&gt;IsManuallyInstalled&lt;/CODE&gt; monthly. &lt;CODE&gt;IsManuallyInstalled&lt;/CODE&gt; has two values: true and false. So I want cumulative sum of true and false monthly.&lt;BR /&gt;
I did it this way:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="D:\\Splunk Data\\RSD Demo\\*" host="PU4D9W0ND02" index="test" sourcetype="RSD_Log"|spath| rex "IPAddress=\"(?&amp;lt;IPAddress&amp;gt;[^\"]*)\" IsManuallyInstalled=\"(?&amp;lt;IsManuallyInstalled&amp;gt;[^\"]*)\"" | dedup IPAddress sortby -_time |timechart span=1mon count(IPAddress) As "MachineCount" by IsManuallyInstalled |streamstats global=f  sum(MachineCount)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But it is not giving the expected result as I supposed streamstats not working. It is giving the same result if I remove:&lt;BR /&gt;
&lt;STRONG&gt;|streamstats global=f  sum(MachineCount).&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Please help how can i achieve this?&lt;/P&gt;

&lt;P&gt;Regards, &lt;BR /&gt;
Aditya&lt;/P&gt;</description>
    <pubDate>Tue, 09 Jun 2015 08:28:21 GMT</pubDate>
    <dc:creator>adityaanand</dc:creator>
    <dc:date>2015-06-09T08:28:21Z</dc:date>
    <item>
      <title>why is Streamstats not working ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/why-is-Streamstats-not-working/m-p/145553#M40580</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I am trying to find cumulative sum of unique &lt;CODE&gt;IPAddress&lt;/CODE&gt; by &lt;CODE&gt;IsManuallyInstalled&lt;/CODE&gt; monthly. &lt;CODE&gt;IsManuallyInstalled&lt;/CODE&gt; has two values: true and false. So I want cumulative sum of true and false monthly.&lt;BR /&gt;
I did it this way:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="D:\\Splunk Data\\RSD Demo\\*" host="PU4D9W0ND02" index="test" sourcetype="RSD_Log"|spath| rex "IPAddress=\"(?&amp;lt;IPAddress&amp;gt;[^\"]*)\" IsManuallyInstalled=\"(?&amp;lt;IsManuallyInstalled&amp;gt;[^\"]*)\"" | dedup IPAddress sortby -_time |timechart span=1mon count(IPAddress) As "MachineCount" by IsManuallyInstalled |streamstats global=f  sum(MachineCount)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But it is not giving the expected result as I supposed streamstats not working. It is giving the same result if I remove:&lt;BR /&gt;
&lt;STRONG&gt;|streamstats global=f  sum(MachineCount).&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Please help how can i achieve this?&lt;/P&gt;

&lt;P&gt;Regards, &lt;BR /&gt;
Aditya&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jun 2015 08:28:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/why-is-Streamstats-not-working/m-p/145553#M40580</guid>
      <dc:creator>adityaanand</dc:creator>
      <dc:date>2015-06-09T08:28:21Z</dc:date>
    </item>
    <item>
      <title>Re: why is Streamstats not working ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/why-is-Streamstats-not-working/m-p/145554#M40581</link>
      <description>&lt;P&gt;This could be done with a simple &lt;CODE&gt;stats&lt;/CODE&gt;, such as this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; source="D:\\Splunk Data\\RSD Demo\\*" host="PU4D9W0ND02" index="test" sourcetype="RSD_Log"|spath| rex "IPAddress=\"(?&amp;lt;IPAddress&amp;gt;[^\"]*)\" IsManuallyInstalled=\"(?&amp;lt;IsManuallyInstalled&amp;gt;[^\"]*)\"" | dedup IPAddress sortby -_time | stats count by IsManuallyInstalled
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you want these results per month:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="D:\\Splunk Data\\RSD Demo\\*" host="PU4D9W0ND02" index="test" sourcetype="RSD_Log"|spath| rex "IPAddress=\"(?&amp;lt;IPAddress&amp;gt;[^\"]*)\" IsManuallyInstalled=\"(?&amp;lt;IsManuallyInstalled&amp;gt;[^\"]*)\"" | dedup IPAddress sortby -_time | eval month=strftime(_time, "%B") | stats count by IsManuallyInstalled month
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Be careful not to run this search over more than a year, or include the year in strftime as well.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jun 2015 12:45:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/why-is-Streamstats-not-working/m-p/145554#M40581</guid>
      <dc:creator>jeffland</dc:creator>
      <dc:date>2015-06-09T12:45:59Z</dc:date>
    </item>
    <item>
      <title>Re: why is Streamstats not working ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/why-is-Streamstats-not-working/m-p/145555#M40582</link>
      <description>&lt;P&gt;It is not giving cumulative sum.&lt;BR /&gt;
Suppose in April month false count is 3 and in May false count is 6 then&lt;BR /&gt;
Result should be like this:&lt;BR /&gt;
April - 3&lt;BR /&gt;
May - 9&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2015 11:48:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/why-is-Streamstats-not-working/m-p/145555#M40582</guid>
      <dc:creator>adityaanand</dc:creator>
      <dc:date>2015-06-10T11:48:01Z</dc:date>
    </item>
    <item>
      <title>Re: why is Streamstats not working ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/why-is-Streamstats-not-working/m-p/145556#M40583</link>
      <description>&lt;P&gt;Edit: this is now obsolete.&lt;/P&gt;

&lt;P&gt;Ah! I see. Sorry, somehow overlooked the "cumulative" in your question and wondered why you were using &lt;CODE&gt;streamstats&lt;/CODE&gt;...&lt;/P&gt;

&lt;P&gt;In your case, a way to do it would be via &lt;CODE&gt;accum&lt;/CODE&gt;, something like&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="D:\\Splunk Data\\RSD Demo\\*" host="PU4D9W0ND02" index="test" sourcetype="RSD_Log"|spath| rex "IPAddress=\"(?&amp;lt;IPAddress&amp;gt;[^\"]*)\" IsManuallyInstalled=\"(?&amp;lt;IsManuallyInstalled&amp;gt;[^\"]*)\"" | dedup IPAddress sortby -_time |timechart span=1mon count(IPAddress) As "MachineCount" by IsManuallyInstalled | accum MachineCount as AccumulatedMachineCount
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 Jun 2015 12:37:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/why-is-Streamstats-not-working/m-p/145556#M40583</guid>
      <dc:creator>jeffland</dc:creator>
      <dc:date>2015-06-10T12:37:07Z</dc:date>
    </item>
    <item>
      <title>Re: why is Streamstats not working ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/why-is-Streamstats-not-working/m-p/145557#M40584</link>
      <description>&lt;P&gt;Hm, on second thought: your timechart has a by-clause. That means your columns are titled "true" and "false" (or how the results of IsManuallyInstalled are precisely), and you need to work your streamstats on those titles - i.e. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="D:\\Splunk Data\\RSD Demo\\*" host="PU4D9W0ND02" index="test" sourcetype="RSD_Log"|spath| rex "IPAddress=\"(?&amp;lt;IPAddress&amp;gt;[^\"]*)\" IsManuallyInstalled=\"(?&amp;lt;IsManuallyInstalled&amp;gt;[^\"]*)\"" | dedup IPAddress sortby -_time |timechart span=1mon count(IPAddress) by IsManuallyInstalled |streamstats sum(true) sum(false)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 Jun 2015 12:48:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/why-is-Streamstats-not-working/m-p/145557#M40584</guid>
      <dc:creator>jeffland</dc:creator>
      <dc:date>2015-06-10T12:48:36Z</dc:date>
    </item>
    <item>
      <title>Re: why is Streamstats not working ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/why-is-Streamstats-not-working/m-p/145558#M40585</link>
      <description>&lt;P&gt;It looks like you want a &lt;EM&gt;distinct&lt;/EM&gt; count, the &lt;CODE&gt;dc()&lt;/CODE&gt; method...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="D:\\Splunk Data\\RSD Demo\\*" host="PU4D9W0ND02" index="test" sourcetype="RSD_Log" 
|spath 
| rex "IPAddress=\"(?&amp;lt;IPAddress&amp;gt;[^\"]*)\" IsManuallyInstalled=\"(?&amp;lt;IsManuallyInstalled&amp;gt;[^\"]*)\""  
| timechart span=1mon dc(IPAddress) As "MachineCount" by IsManuallyInstalled 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Using &lt;CODE&gt;dc()&lt;/CODE&gt; lets you get rid of that &lt;CODE&gt;dedup&lt;/CODE&gt;. &lt;/P&gt;

&lt;P&gt;I question the necessity of using both &lt;CODE&gt;spath&lt;/CODE&gt; and &lt;CODE&gt;rex&lt;/CODE&gt;, but you know your dataset better than I do. &lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2015 13:01:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/why-is-Streamstats-not-working/m-p/145558#M40585</guid>
      <dc:creator>jacobwilkins</dc:creator>
      <dc:date>2015-06-10T13:01:56Z</dc:date>
    </item>
    <item>
      <title>Re: why is Streamstats not working ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/why-is-Streamstats-not-working/m-p/145559#M40586</link>
      <description>&lt;P&gt;Oh, and you were looking for accumulations. Yeah. Listen to jeffland&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2015 13:08:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/why-is-Streamstats-not-working/m-p/145559#M40586</guid>
      <dc:creator>jacobwilkins</dc:creator>
      <dc:date>2015-06-10T13:08:00Z</dc:date>
    </item>
    <item>
      <title>Re: why is Streamstats not working ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/why-is-Streamstats-not-working/m-p/145560#M40587</link>
      <description>&lt;P&gt;I also noticed the count/distinct count issue, but then saw the dedup ahead of it which makes dc redundant.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2015 13:16:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/why-is-Streamstats-not-working/m-p/145560#M40587</guid>
      <dc:creator>jeffland</dc:creator>
      <dc:date>2015-06-10T13:16:58Z</dc:date>
    </item>
  </channel>
</rss>

