<?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 to create a linechart showing the previous 6 months with each point being the sum of the previous 6 months? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-linechart-showing-the-previous-6-months-with/m-p/334948#M99545</link>
    <description>&lt;P&gt;This should be what you're looking for, run over &lt;CODE&gt;@mon-10mon to now&lt;/CODE&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=foo sourcetype=bar etc... | timechart span=1mon sum(field1) as monthly_sum
| streamstats window=6 sum(monthly_sum) as sixmonthly_sum | fields - monthly_sum
| where _time &amp;gt;= relative_time(now(), "@mon-5mon")
| eval sixmonthly_sum = case(sixmonthly_sum&amp;gt;0, sixmonthly_sum)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;UL&gt;
&lt;LI&gt;search for your data, compute monthly sums&lt;/LI&gt;
&lt;LI&gt;compute running six-month-sums, drop monthly sums&lt;/LI&gt;
&lt;LI&gt;drop first five months&lt;/LI&gt;
&lt;LI&gt;remove zeroes, make sure the line chart is set to connect on missing values&lt;/LI&gt;
&lt;/UL&gt;</description>
    <pubDate>Sat, 09 Dec 2017 23:07:14 GMT</pubDate>
    <dc:creator>martin_mueller</dc:creator>
    <dc:date>2017-12-09T23:07:14Z</dc:date>
    <item>
      <title>How to create a linechart showing the previous 6 months with each point being the sum of the previous 6 months?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-linechart-showing-the-previous-6-months-with/m-p/334947#M99544</link>
      <description>&lt;P&gt;Im trying to show a trend using a linechart.  It should show the previous 6 months and have a data point once for each month.  The data point should be sum of events for the previous 6 months, and the labels across the x-axis should just be the month name.  For example if today is Dec 15, the x-axis would have the labels July, Aug, Sept, Oct, Nov, Dec.  The July data point would be the sum of the value of field1 for all events that occurred in Feb-July.  The Dec data point would be the sum of the value of field1 for July - the current date in Dec.  Finally, if for some reason there are no events in that time period the line should not go to 0, but the last two data points should connect.  How would I create a search like this?&lt;/P&gt;</description>
      <pubDate>Sat, 09 Dec 2017 04:30:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-linechart-showing-the-previous-6-months-with/m-p/334947#M99544</guid>
      <dc:creator>glenngermiathen</dc:creator>
      <dc:date>2017-12-09T04:30:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a linechart showing the previous 6 months with each point being the sum of the previous 6 months?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-linechart-showing-the-previous-6-months-with/m-p/334948#M99545</link>
      <description>&lt;P&gt;This should be what you're looking for, run over &lt;CODE&gt;@mon-10mon to now&lt;/CODE&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=foo sourcetype=bar etc... | timechart span=1mon sum(field1) as monthly_sum
| streamstats window=6 sum(monthly_sum) as sixmonthly_sum | fields - monthly_sum
| where _time &amp;gt;= relative_time(now(), "@mon-5mon")
| eval sixmonthly_sum = case(sixmonthly_sum&amp;gt;0, sixmonthly_sum)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;UL&gt;
&lt;LI&gt;search for your data, compute monthly sums&lt;/LI&gt;
&lt;LI&gt;compute running six-month-sums, drop monthly sums&lt;/LI&gt;
&lt;LI&gt;drop first five months&lt;/LI&gt;
&lt;LI&gt;remove zeroes, make sure the line chart is set to connect on missing values&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Sat, 09 Dec 2017 23:07:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-linechart-showing-the-previous-6-months-with/m-p/334948#M99545</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2017-12-09T23:07:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a linechart showing the previous 6 months with each point being the sum of the previous 6 months?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-linechart-showing-the-previous-6-months-with/m-p/334949#M99546</link>
      <description>&lt;P&gt;Thanks that works great!  I have one more kink I need to work out though.  For each of the 6 month periods the host event count fields can repeat, and I only need to sum the most recent event count for all the hosts in that period.  I have data sorted, and then I want to dedup on the hostname for each 6 month period.  How would I go about doing that?  My data looks like:&lt;BR /&gt;
Host "Event Count" _time&lt;BR /&gt;
HostA 500 time&lt;BR /&gt;
HostA 450 time&lt;BR /&gt;
HostB 1000 time...&lt;/P&gt;</description>
      <pubDate>Sun, 10 Dec 2017 21:44:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-linechart-showing-the-previous-6-months-with/m-p/334949#M99546</guid>
      <dc:creator>glenngermiathen</dc:creator>
      <dc:date>2017-12-10T21:44:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a linechart showing the previous 6 months with each point being the sum of the previous 6 months?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-linechart-showing-the-previous-6-months-with/m-p/334950#M99547</link>
      <description>&lt;P&gt;To get the latest value per host per month, use this beginning:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=foo sourcetype=bar etc... | bin span=1mon _time as month | dedup host month | timechart ...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 10 Dec 2017 21:59:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-linechart-showing-the-previous-6-months-with/m-p/334950#M99547</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2017-12-10T21:59:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a linechart showing the previous 6 months with each point being the sum of the previous 6 months?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-linechart-showing-the-previous-6-months-with/m-p/334951#M99548</link>
      <description>&lt;P&gt;Right, but this would dedup the 1 month periods, but Im need to do it for the 6 month period.  Am I correct that if I did&lt;BR /&gt;
| bin span=6mon that it would group distinct periods ie Jan-Jun July-Dec, rather than Jun-Nov July-Dec?&lt;/P&gt;</description>
      <pubDate>Sun, 10 Dec 2017 22:54:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-linechart-showing-the-previous-6-months-with/m-p/334951#M99548</guid>
      <dc:creator>glenngermiathen</dc:creator>
      <dc:date>2017-12-10T22:54:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a linechart showing the previous 6 months with each point being the sum of the previous 6 months?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-linechart-showing-the-previous-6-months-with/m-p/334952#M99549</link>
      <description>&lt;P&gt;So... you don't want to compute a sum of &lt;CODE&gt;field1&lt;/CODE&gt; over a six-month period but rather use the field value from the latest event? I'm confused.&lt;/P&gt;</description>
      <pubDate>Sun, 10 Dec 2017 22:59:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-linechart-showing-the-previous-6-months-with/m-p/334952#M99549</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2017-12-10T22:59:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a linechart showing the previous 6 months with each point being the sum of the previous 6 months?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-linechart-showing-the-previous-6-months-with/m-p/334953#M99550</link>
      <description>&lt;P&gt;Sorry I didn't explain very clearly. field1is the "Event Count", and every host has an event count associated with it.  A host can be listed many times in the 6 month periods, so I want to count each host once in that period using the most recent occurrence of that host.  Then with the list of unique hosts sum the "event count" field for that 6 month period.  For example lets say hostA shows up 2 times each month. For the July-Dec bucket only the most recent event count for hostA would be summed up with the event counts for the most recent occurrences of the other hosts.  Then For the June-Nov bucket it would be the most recent occurrence in Nov that was used the in summation.  Hope this is clearer.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2017 04:38:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-linechart-showing-the-previous-6-months-with/m-p/334953#M99550</guid>
      <dc:creator>glenngermiathen</dc:creator>
      <dc:date>2017-12-11T04:38:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a linechart showing the previous 6 months with each point being the sum of the previous 6 months?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-linechart-showing-the-previous-6-months-with/m-p/334954#M99551</link>
      <description>&lt;P&gt;My confusion isn't decreasing &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt; let's whip up an example for just one host:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;June 1st: 1
June 15th: 2
July 1st: 4
July 15th: 8
July 31st: 16
August 1st: 32
August 15th: 64
August 31st: 128
September 1st: 256
October 1st: 512
October 15th: 1024
November 1st: 2048
December 1st: 4096
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What should the value be for November? What value for December?&lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2017 10:55:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-linechart-showing-the-previous-6-months-with/m-p/334954#M99551</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2017-12-11T10:55:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a linechart showing the previous 6 months with each point being the sum of the previous 6 months?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-linechart-showing-the-previous-6-months-with/m-p/334955#M99552</link>
      <description>&lt;P&gt;Sorry for the late reply, the value for Nov should be 2048 and Dec 4096&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2017 13:13:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-linechart-showing-the-previous-6-months-with/m-p/334955#M99552</guid>
      <dc:creator>glenngermiathen</dc:creator>
      <dc:date>2017-12-14T13:13:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a linechart showing the previous 6 months with each point being the sum of the previous 6 months?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-linechart-showing-the-previous-6-months-with/m-p/334956#M99553</link>
      <description>&lt;P&gt;So... there should be no summing up of previous months, just the latest value over that six-month window?&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2017 23:06:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-linechart-showing-the-previous-6-months-with/m-p/334956#M99553</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2017-12-14T23:06:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a linechart showing the previous 6 months with each point being the sum of the previous 6 months?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-linechart-showing-the-previous-6-months-with/m-p/334957#M99554</link>
      <description>&lt;P&gt;In the case of one asset their is no sum, but with multiple assets you would sum the latest value of each asset over the six month windows.  For example if you had two assets:&lt;BR /&gt;
Asset A, Oct 1: 100&lt;BR /&gt;
Asset A, Oct 15: 500&lt;BR /&gt;
Asset A, Dec 1: 250&lt;BR /&gt;
Asset B, Oct 2: 200&lt;BR /&gt;
Asset B, Nov 1: 300&lt;/P&gt;

&lt;P&gt;Oct = 700 (sum Asset A oct 15 and Asset B Oct 2)&lt;BR /&gt;
Nov = 800 (sum Asset A Oct 15 and Asset B Nov 1)&lt;BR /&gt;
Dec = 550 (sun Asset A Dec 1 and Asset B Nov1)&lt;/P&gt;</description>
      <pubDate>Mon, 18 Dec 2017 21:03:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-linechart-showing-the-previous-6-months-with/m-p/334957#M99554</guid>
      <dc:creator>glenngermiathen</dc:creator>
      <dc:date>2017-12-18T21:03:50Z</dc:date>
    </item>
  </channel>
</rss>

