<?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: diff between same field between two iterations in Knowledge Management</title>
    <link>https://community.splunk.com/t5/Knowledge-Management/diff-between-same-field-between-two-iterations/m-p/265145#M6772</link>
    <description>&lt;P&gt;Thank you. I've only sample data mentioned.  Need a query to calculate diffCN.&lt;/P&gt;</description>
    <pubDate>Wed, 01 Feb 2017 05:47:03 GMT</pubDate>
    <dc:creator>rajkumar_2</dc:creator>
    <dc:date>2017-02-01T05:47:03Z</dc:date>
    <item>
      <title>diff between same field between two iterations</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/diff-between-same-field-between-two-iterations/m-p/265143#M6770</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have the below sample data collected after process and using table command every 24 hours.  for each time, db, id, we need to calculated the difference.  For example  the output should be:  &lt;/P&gt;

&lt;P&gt;prevtime latesttime DB  ID  diffCN  diffSYM diffIS  diffSED diffSEC diffSCR diffSCRSYM  diffSCRIS   diffSCRSED&lt;BR /&gt;
2017-01-30T02:15:16.000-0800 2017-01-31T02:15:22.000-0800 yods 10019488 0   0   0   0   0   0   0&lt;BR /&gt;
2017-01-30T02:15:16.000-0800 2017-01-31T02:15:22.000-0800 yods 10000004 0.95    1.38    0.8 1.42    1.32    -1.52   1.48&lt;/P&gt;

&lt;P&gt;in above 2 row, for db yods(id 10000004) diffCN value 0.95 came from subtracting 83.24-82.29. &lt;BR /&gt;
We need to get same for the remaining rows too.  Please help.&lt;/P&gt;

&lt;P&gt;Sample Data:&lt;/P&gt;

&lt;P&gt;_time   DB  ID  CN  SYM IS  SED SEC SCR SCRSYM  SCRIS   SCRSED&lt;BR /&gt;
2017-01-30T02:15:16.000-0800    yods    10019488    0   0   100 0   0   0   0   100 0&lt;BR /&gt;
2017-01-30T02:15:16.000-0800    yods    10000004    82.29   84.89   78.98   76.53   82.21   34.35   82.56   2.1 0.44&lt;BR /&gt;
2017-01-30T02:15:16.000-0800    pnrb02  10010160    38.17   54  56.85   32.13   39.47   0   25.35   55  0&lt;BR /&gt;
2017-01-30T02:15:16.000-0800    caun2   10019060    86.5    84.41   81.37   62.74   90.87   35.74   80.04   0.19    0&lt;BR /&gt;
2017-01-30T02:15:16.000-0800    cana1s  10018996    0   0   0   0   0   0   0   0   0&lt;BR /&gt;
2017-01-30T02:15:16.000-0800    produc1 10010352    81.35   88.38   90.54   81.62   81.35   33.24   88.38   11.08   2.43&lt;BR /&gt;
2017-01-30T02:15:28.000-0800    casn20  10013160    84.07   86.51   78.63   61.84   89.19   28.23   79.32   0.15    0.08&lt;/P&gt;

&lt;P&gt;2017-01-31T02:15:22.000-0800    yods    10019488    0   0   100 0   0   0   0   100 0&lt;BR /&gt;
2017-01-31T02:15:22.000-0800    yods    10000004    83.24   86.27   79.78   77.95   83.53   32.83   84.04   1.51    0.33&lt;BR /&gt;
2017-01-31T02:15:22.000-0800    pnrb02  10010160    83.24   82.08   92.92   73.87   83.52   0   3.08    92.61   0&lt;BR /&gt;
2017-01-31T02:15:22.000-0800    caun2   10019060    89.15   89  84.46   64.81   91.94   39.44   85.78   0.15    0&lt;BR /&gt;
2017-01-31T02:15:22.000-0800    cana1s  10018996    0   0   0   0   0   0   0   0   0&lt;BR /&gt;
2017-01-31T02:15:22.000-0800    produc1 10010352    92.09   96.33   90.55   89.68   92.06   6.88    96.33   0.96    0.26&lt;BR /&gt;
2017-01-31T02:15:58.000-0800    casn20  10013160    83.69   86.27   78.11   61.34   88.87   27.78   79.14   0.19    0.1&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2017 11:43:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/diff-between-same-field-between-two-iterations/m-p/265143#M6770</guid>
      <dc:creator>rajkumar_2</dc:creator>
      <dc:date>2017-01-31T11:43:35Z</dc:date>
    </item>
    <item>
      <title>Re: diff between same field between two iterations</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/diff-between-same-field-between-two-iterations/m-p/265144#M6771</link>
      <description>&lt;P&gt;Try like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your current search giving difference right now | eventstats values(diffCN) as diffCN by _time DB
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;UPdate&lt;/STRONG&gt;&lt;BR /&gt;
Assuming the selected time range only selects data for two days&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=foo sourcetype=bar
| stats min(_time) as prevtime max(_time) as latesttime
earliest(CN) as prevCN latest(CN) as latestCN
earliest(SYM) as prevSYM latest(SYM) as latestSYM
earliest(IS) as prevIS latest(IS) as latestIS
earliest(SED) as prevSED latest(SED) as latestSED
earliest(SEC) as prevSEC latest(SEC) as latestSEC
earliest(SCR) as prevSCR latest(SCR) as latestSCR
earliest(SCRSYM) as prevSCRSYM latest(SCRSYM) as latestSCRSYM
earliest(SCRIS) as prevSCRIS latest(SCRIS) as latestSCRIS
earliest(SCRSED) as prevSCRSED latest(SCRSED) as latestSCRSED by DB ID
| eval diffCN=latestCN-prevCN
| eval diffSYM=latestSYM-prevSYM
| eval diffIS=latestIS-prevIS
| eval diffSED=latestSED-prevSED
| eval diffSEC=latestSEC-prevSEC
| eval diffSCR=latestSCR-prevSCR
| eval diffSCRSYM=latestSCRSYM-prevSCRSYM
| eval diffSCRIS=latestSCRIS-prevSCRIS
| eval diffSCRSED=latestSCRSED-prevSCRSED
| table prevtime latesttime DB ID diff*
| convert ctime(*time) timeformat="%Y-%m-%dT%H:%M:%S.%N%z"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 31 Jan 2017 14:48:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/diff-between-same-field-between-two-iterations/m-p/265144#M6771</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-01-31T14:48:53Z</dc:date>
    </item>
    <item>
      <title>Re: diff between same field between two iterations</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/diff-between-same-field-between-two-iterations/m-p/265145#M6772</link>
      <description>&lt;P&gt;Thank you. I've only sample data mentioned.  Need a query to calculate diffCN.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2017 05:47:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/diff-between-same-field-between-two-iterations/m-p/265145#M6772</guid>
      <dc:creator>rajkumar_2</dc:creator>
      <dc:date>2017-02-01T05:47:03Z</dc:date>
    </item>
    <item>
      <title>Re: diff between same field between two iterations</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/diff-between-same-field-between-two-iterations/m-p/265146#M6773</link>
      <description>&lt;P&gt;Thank you.  The query fits the purpose.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2017 10:45:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/diff-between-same-field-between-two-iterations/m-p/265146#M6773</guid>
      <dc:creator>rajkumar_2</dc:creator>
      <dc:date>2017-02-02T10:45:41Z</dc:date>
    </item>
  </channel>
</rss>

