<?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: How can I do a cumulative timechart with dedup? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-do-a-cumulative-timechart-with-dedup/m-p/233519#M69342</link>
    <description>&lt;P&gt;Well, I thought it worked, but it's not able to decrease count. So if a fail later becomes a pass, it will +1 the pass, but the fail count stays the same, due to losing the &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|dedup 1 hostname,requirement sortby - _time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;functionailty. but I think this might also be solvable with streamstats. I'll dig further in. Thanks again!&lt;/P&gt;</description>
    <pubDate>Fri, 15 Jan 2016 00:04:58 GMT</pubDate>
    <dc:creator>ITSX</dc:creator>
    <dc:date>2016-01-15T00:04:58Z</dc:date>
    <item>
      <title>How can I do a cumulative timechart with dedup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-do-a-cumulative-timechart-with-dedup/m-p/233515#M69338</link>
      <description>&lt;P&gt;I've got some data with three applicable fields, hostname, requirement, and requirementstatus. Each day I may receive hundreds of log for a single hostname, or none at all. a stream of logs might look like &lt;/P&gt;

&lt;P&gt;&amp;gt;hostname="comp1" requirement=foo requirementstatus=failed&lt;BR /&gt;
&amp;gt;hostname="comp1" requirement=bar requirementstatus=passed&lt;BR /&gt;
&amp;gt;hostname="comp1" requirement=foo requirementstatus=passed&lt;BR /&gt;
&amp;gt;hostname="comp1" requirement=bar requirementstatus=passed&lt;/P&gt;

&lt;P&gt;I can get the current requirementstatus for each requirement with &lt;/P&gt;

&lt;P&gt;&amp;gt;|dedup 1 hostname,requirement sortby - _time|table hostname,requirement,requirementstatus&lt;/P&gt;

&lt;P&gt;but how do i get the current, cumulative status per day in a timechart? &lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;So on day one, I have 50 hostnames with a requirement "foo" and 25 have a requirementstatus of "passed" and 25 "failed"&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;Day two, 10 hostnames that previously had a requirementstatus of "failed" are now "passed", and they're the &lt;STRONG&gt;only&lt;/STRONG&gt; logs received on day two&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;my chart when filtered to requirement "foo"  should show day1 with 25 passes and 25 fails, day 2 with 35 passes and 15 fails. &lt;/P&gt;

&lt;P&gt;I appreciate any insight you can give. &lt;/P&gt;</description>
      <pubDate>Thu, 14 Jan 2016 21:56:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-do-a-cumulative-timechart-with-dedup/m-p/233515#M69338</guid>
      <dc:creator>ITSX</dc:creator>
      <dc:date>2016-01-14T21:56:43Z</dc:date>
    </item>
    <item>
      <title>Re: How can I do a cumulative timechart with dedup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-do-a-cumulative-timechart-with-dedup/m-p/233516#M69339</link>
      <description>&lt;P&gt;I guess what i'm trying to do is have my timechart bins be day1, day1+2, day1+2+3, etc., if that makes any sense.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jan 2016 22:29:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-do-a-cumulative-timechart-with-dedup/m-p/233516#M69339</guid>
      <dc:creator>ITSX</dc:creator>
      <dc:date>2016-01-14T22:29:32Z</dc:date>
    </item>
    <item>
      <title>Re: How can I do a cumulative timechart with dedup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-do-a-cumulative-timechart-with-dedup/m-p/233517#M69340</link>
      <description>&lt;P&gt;Here is one way to do one requirement:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;requirement=foo
| timechart 
count(eval(requirementstatus="passed")) as passes, 
count(eval(requirementstatus="failed")) as fails
by hostname
| streamstats sum(passes) as cumsum_passes, sum(fails) as cumsum_fails
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It sounds like you are mostly looking for the &lt;CODE&gt;streamstats&lt;/CODE&gt; &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.3.0/SearchReference/streamstats"&gt;command&lt;/A&gt;. &lt;/P&gt;</description>
      <pubDate>Thu, 14 Jan 2016 23:05:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-do-a-cumulative-timechart-with-dedup/m-p/233517#M69340</guid>
      <dc:creator>aljohnson_splun</dc:creator>
      <dc:date>2016-01-14T23:05:15Z</dc:date>
    </item>
    <item>
      <title>Re: How can I do a cumulative timechart with dedup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-do-a-cumulative-timechart-with-dedup/m-p/233518#M69341</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;|bucket span=1d _time
 |chart 
 count(eval(requirementstatus="passed")) as passesPerPeriod, 
 count(eval(requirementstatus="failed")) as failsperPeriod
 by _time
 | streamstats sum(passesPerPeriod) as CumulativePassed, sum(failsperPeriod) as CumulativeFailed
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;works splendidly. Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jan 2016 23:44:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-do-a-cumulative-timechart-with-dedup/m-p/233518#M69341</guid>
      <dc:creator>ITSX</dc:creator>
      <dc:date>2016-01-14T23:44:48Z</dc:date>
    </item>
    <item>
      <title>Re: How can I do a cumulative timechart with dedup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-do-a-cumulative-timechart-with-dedup/m-p/233519#M69342</link>
      <description>&lt;P&gt;Well, I thought it worked, but it's not able to decrease count. So if a fail later becomes a pass, it will +1 the pass, but the fail count stays the same, due to losing the &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|dedup 1 hostname,requirement sortby - _time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;functionailty. but I think this might also be solvable with streamstats. I'll dig further in. Thanks again!&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jan 2016 00:04:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-do-a-cumulative-timechart-with-dedup/m-p/233519#M69342</guid>
      <dc:creator>ITSX</dc:creator>
      <dc:date>2016-01-15T00:04:58Z</dc:date>
    </item>
    <item>
      <title>Re: How can I do a cumulative timechart with dedup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-do-a-cumulative-timechart-with-dedup/m-p/233520#M69343</link>
      <description>&lt;P&gt;You can do some tricky work probably with case to make the success equal to 1, and the fail equal to -1 - then you can use streamstats sum to add it up and have the failures decrease the total.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|bucket span=1d _time
|chart 
count(eval(requirementstatus="passed")) as passesPerPeriod, 
count(eval(requirementstatus="failed")) as failsperPeriod
| eval requirementstatus_count = case(
requirementstatus="passed", 1, 
requirementstatus="failed", -1)
| streamstats 
sum(passesPerPeriod) as CumulativePassed
sum(failsperPeriod) as CumulativeFailed
sum(requirementstatus_count) as period_balanced_total
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Or something of the sort ... ?&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jan 2016 02:23:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-do-a-cumulative-timechart-with-dedup/m-p/233520#M69343</guid>
      <dc:creator>aljohnson_splun</dc:creator>
      <dc:date>2016-01-15T02:23:10Z</dc:date>
    </item>
    <item>
      <title>Re: How can I do a cumulative timechart with dedup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-do-a-cumulative-timechart-with-dedup/m-p/233521#M69344</link>
      <description>&lt;P&gt;Or if you need the period balanced total by time-bucket&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; |bucket span=1d _time
 |chart 
 count(eval(requirementstatus="passed")) as passesPerPeriod, 
 count(eval(requirementstatus="failed")) as failsperPeriod
 | eval requirementstatus_count = case(
 requirementstatus="passed", 1, 
 requirementstatus="failed", -1)
 | streamstats 
 sum(passesPerPeriod) as CumulativePassed
 sum(failsperPeriod) as CumulativeFailed
 | eventstats sum(requirementstatus_count) as period_balanced_total by _time
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 15 Jan 2016 02:24:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-do-a-cumulative-timechart-with-dedup/m-p/233521#M69344</guid>
      <dc:creator>aljohnson_splun</dc:creator>
      <dc:date>2016-01-15T02:24:48Z</dc:date>
    </item>
  </channel>
</rss>

