<?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: Data Field Entries Across Different Time Spans per Entry in Knowledge Management</title>
    <link>https://community.splunk.com/t5/Knowledge-Management/Data-Field-Entries-Across-Different-Time-Spans-per-Entry/m-p/35051#M7092</link>
    <description>&lt;P&gt;Thanks for the feedback. Great answer to my question, it certainly is "close enough" haha.&lt;/P&gt;</description>
    <pubDate>Wed, 15 Aug 2012 23:34:13 GMT</pubDate>
    <dc:creator>mmedal</dc:creator>
    <dc:date>2012-08-15T23:34:13Z</dc:date>
    <item>
      <title>Data Field Entries Across Different Time Spans per Entry</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/Data-Field-Entries-Across-Different-Time-Spans-per-Entry/m-p/35049#M7090</link>
      <description>&lt;P&gt;I have a bunch of SAN usage data that I am inputting into Splunk that looks as follows, with each line representing an entry in Splunk:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Group: diskdg1 Disks: 21 Disk in use: data04 Capacity: 1%  
Group: diskdg2 Disks: 21 Disk in use: data05 Capacity: 1%  
Group: diskdg3 Disks: 5 Disk in use: data01 Capacity: 33%  
Group: diskdg4 Disks: 34 Disk in use: data08 Capacity: 1%  
Group: diskdg5 Disks: 30 Disk in use: data07 Capacity: 1%  
Group: diskdg6 Disks: 38 Disk in use: data09 Capacity: 25%
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What I would like to do is display a table with these fields, plus a new field displaying a "change in capacity" since 7 days ago. In other words, I would like to evaluate the difference between the capacity field now and the capacity field for that entry 7 days ago.&lt;/P&gt;

&lt;P&gt;Can anyone assist me with a search?&lt;/P&gt;

&lt;P&gt;Thanks so much, Matt&lt;/P&gt;</description>
      <pubDate>Tue, 14 Aug 2012 22:57:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/Data-Field-Entries-Across-Different-Time-Spans-per-Entry/m-p/35049#M7090</guid>
      <dc:creator>mmedal</dc:creator>
      <dc:date>2012-08-14T22:57:36Z</dc:date>
    </item>
    <item>
      <title>Re: Data Field Entries Across Different Time Spans per Entry</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/Data-Field-Entries-Across-Different-Time-Spans-per-Entry/m-p/35050#M7091</link>
      <description>&lt;P&gt;At first glance, the difference should be pretty easy - you can use the &lt;CODE&gt;delta&lt;/CODE&gt; search command.  But, &lt;CODE&gt;delta&lt;/CODE&gt; lacks a &lt;CODE&gt;by&lt;/CODE&gt; clause so you could only do one &lt;CODE&gt;Group&lt;/CODE&gt; at a time - a bit of a limitation.  But, I think you can use &lt;CODE&gt;streamstats&lt;/CODE&gt; to roughly create a &lt;CODE&gt;delta&lt;/CODE&gt; per-Group.&lt;/P&gt;

&lt;P&gt;Assuming that your data above has field extractions for &lt;CODE&gt;Group&lt;/CODE&gt; and &lt;CODE&gt;Capacity&lt;/CODE&gt; then a search like this should get you close:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=my_san_data 
| streamstats last(Capacity) as high first(Capacity) as low by Group window=7 global=f 
| eval delta=high-low
| table _time,Group,Capacity,delta
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You may need to swap around high vs low just to get it to work out mathematically right.  There is an assumption here that you are collecting this data once per day.  The way this "should" work is &lt;CODE&gt;streamstats&lt;/CODE&gt; will do a sliding window of 7 events per &lt;CODE&gt;Group&lt;/CODE&gt; and use the first and last values of &lt;CODE&gt;Capacity&lt;/CODE&gt; within each of those sliding windows to calculate a delta.  &lt;/P&gt;

&lt;P&gt;Obviously a sliding window of 7 events is not necessarily &lt;STRONG&gt;strictly&lt;/STRONG&gt; 7 days.  It depends on you collecting exactly once per day, every day, without missing one.  If you are collecting once per hour, then you can adjust &lt;CODE&gt;window&lt;/CODE&gt; to be 168 instead.&lt;/P&gt;

&lt;P&gt;There are some more complicated ways of dealing with this like maintaining state in lookups, or time-oriented subsearches if you need a higher precision than a sliding window.  But, unless your accuracy requirements are very very high, this should be "&lt;A href="http://knowyourmeme.com/memes/close-enough"&gt;close enough&lt;/A&gt;".&lt;/P&gt;</description>
      <pubDate>Wed, 15 Aug 2012 03:07:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/Data-Field-Entries-Across-Different-Time-Spans-per-Entry/m-p/35050#M7091</guid>
      <dc:creator>dwaddle</dc:creator>
      <dc:date>2012-08-15T03:07:16Z</dc:date>
    </item>
    <item>
      <title>Re: Data Field Entries Across Different Time Spans per Entry</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/Data-Field-Entries-Across-Different-Time-Spans-per-Entry/m-p/35051#M7092</link>
      <description>&lt;P&gt;Thanks for the feedback. Great answer to my question, it certainly is "close enough" haha.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Aug 2012 23:34:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/Data-Field-Entries-Across-Different-Time-Spans-per-Entry/m-p/35051#M7092</guid>
      <dc:creator>mmedal</dc:creator>
      <dc:date>2012-08-15T23:34:13Z</dc:date>
    </item>
  </channel>
</rss>

