<?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 make a line chart that shows 6 months of data with each datapoint being a sum of the previous 6 months? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-make-a-line-chart-that-shows-6-months-of-data-with-each/m-p/335107#M99589</link>
    <description>&lt;P&gt;something like this might help you. just start with the &lt;CODE&gt;timechart&lt;/CODE&gt; and tweak it as needed.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults|eval data="platform=Windows,asset=AssetA,event_count=25,date=1483296553 platform=Windows,asset=AssetA,event_count=32,date=1483987753  platform=Windows,asset=AssetA,event_count=13,date=1501609753 platform=Linux,asset=AssetA,event_count=56,date=1493660953 platform=Linux,asset=AssetB,event_count=24,date=1496684953"|makemv data|mvexpand data|rename data as _raw|kv|eval _time=date
| timechart span=1mon sum(event_count) as event_count by platform|makecontinuous span=1mon|fillnull value=0|reverse|streamstats window=6 sum(*) as 6_mo_total_*|reverse|fields _time 6_mo*
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;the problem with the query you had started with was bucketing 6 months and then trying to bucket 1 month in the timechart. because you had already bucketed 6 months, splunk couldn't get more granular than that.&lt;/P&gt;</description>
    <pubDate>Tue, 12 Dec 2017 12:59:51 GMT</pubDate>
    <dc:creator>cmerriman</dc:creator>
    <dc:date>2017-12-12T12:59:51Z</dc:date>
    <item>
      <title>How to make a line chart that shows 6 months of data with each datapoint being a sum of the previous 6 months?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-make-a-line-chart-that-shows-6-months-of-data-with-each/m-p/335105#M99587</link>
      <description>&lt;P&gt;Im trying to show a trend in event data by platform.  I want to create a line chart showing the last 6 months with one data point for each month.  That data point should be the sum of an event field for the previous 6 months.  Assets in the platform group can be repeated in that 6 month period, so I only want the most recent value for that period.  My data looks like&lt;BR /&gt;
Platform Asset Event_count date&lt;BR /&gt;
Windows AssetA 25 1/1/2017&lt;BR /&gt;
Windows AssetA 32 1/9/2017&lt;BR /&gt;
Windows AssetA 13 8/1/2017&lt;BR /&gt;
Linux AssetA 56&lt;BR /&gt;
Linux AssetB 24&lt;/P&gt;

&lt;P&gt;This is what I have come up with, but it is only showing one data point, and I would like the x-axis values to just be the month name.&lt;BR /&gt;
index=foo&lt;BR /&gt;
| fields asset platform event_count&lt;BR /&gt;
| bucket _time span=6mon&lt;BR /&gt;
| dedup asset date&lt;BR /&gt;
| timechart span=1mon sum(event_count) by platform&lt;/P&gt;

&lt;P&gt;Im sure this isn't close to correct, so any help is greatly appreciated.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:12:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-make-a-line-chart-that-shows-6-months-of-data-with-each/m-p/335105#M99587</guid>
      <dc:creator>glenngermiathen</dc:creator>
      <dc:date>2020-09-29T17:12:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to make a line chart that shows 6 months of data with each datapoint being a sum of the previous 6 months?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-make-a-line-chart-that-shows-6-months-of-data-with-each/m-p/335106#M99588</link>
      <description>&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/7.0.0/SearchReference/Streamstats"&gt;Streamstats&lt;/A&gt; may be of use.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=foo earliest=-1y
| fields asset platform event_count
| bucket _time span=1mon
| dedup asset date
| streamstats window=6 sum(event_count) AS 6MonthTotal BY platform
| table _time, platform, 6MonthTotal 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;That's probably missing some of your final data munging and fiddling, but I think that's the core of what you'll need.  Once you get to this point I think you'll find is reasonably easy to do what you need to do, though feel free to post back if you need more help!&lt;/P&gt;

&lt;P&gt;Note I need coffee yet this morning so you &lt;EM&gt;might&lt;/EM&gt; need a &lt;CODE&gt;|reverse&lt;/CODE&gt; ahead of the streamstats.  &lt;/P&gt;

&lt;P&gt;Happy Splunking,&lt;BR /&gt;
Rich&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2017 12:50:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-make-a-line-chart-that-shows-6-months-of-data-with-each/m-p/335106#M99588</guid>
      <dc:creator>Richfez</dc:creator>
      <dc:date>2017-12-12T12:50:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to make a line chart that shows 6 months of data with each datapoint being a sum of the previous 6 months?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-make-a-line-chart-that-shows-6-months-of-data-with-each/m-p/335107#M99589</link>
      <description>&lt;P&gt;something like this might help you. just start with the &lt;CODE&gt;timechart&lt;/CODE&gt; and tweak it as needed.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults|eval data="platform=Windows,asset=AssetA,event_count=25,date=1483296553 platform=Windows,asset=AssetA,event_count=32,date=1483987753  platform=Windows,asset=AssetA,event_count=13,date=1501609753 platform=Linux,asset=AssetA,event_count=56,date=1493660953 platform=Linux,asset=AssetB,event_count=24,date=1496684953"|makemv data|mvexpand data|rename data as _raw|kv|eval _time=date
| timechart span=1mon sum(event_count) as event_count by platform|makecontinuous span=1mon|fillnull value=0|reverse|streamstats window=6 sum(*) as 6_mo_total_*|reverse|fields _time 6_mo*
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;the problem with the query you had started with was bucketing 6 months and then trying to bucket 1 month in the timechart. because you had already bucketed 6 months, splunk couldn't get more granular than that.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2017 12:59:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-make-a-line-chart-that-shows-6-months-of-data-with-each/m-p/335107#M99589</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2017-12-12T12:59:51Z</dc:date>
    </item>
  </channel>
</rss>

