<?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 How to calculate the delta for same event for time difference of 7 days and alert if delta is more than 5% in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-delta-for-same-event-for-time-difference-of/m-p/496327#M138314</link>
    <description>&lt;P&gt;My Search has the below format data.&lt;/P&gt;

&lt;P&gt;A single host has multiple parameters consists of LED 1..to.20 for each TV and there are 24 TV's , The LED power paramerter has value say Max(val) 34.0 which is related to PA (power Amplitude) of Low/High, we only want search for PA = Low&lt;/P&gt;

&lt;P&gt;Query : &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="c:\\program files (x86)\\xxxx" "PLogger" TV earliest=-2d@d latest=now PA = Low | stats max(VAL) by host, TV, LED, PA , _time | fields "host" "LED","PA", "TV", "max(VAL)" |
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Result :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host LED PA TV Max (Val) _Time
03192610158 0 Low A1 48.863 2019-12-19 22:00:08.177
03192610158 0 Low A1 48.61 2019-12-20 22:00:08.140
031................. 1 Low A1 44.23 2019-12-19 22:00:08.177
031................. 1 Low A1 45.23 2019-12-20 22:00:08.177
|||||
|||||
031................. 19 Low A1 49.23 2019-12-19 22:00:08.177
031................. 19 Low A1 50.23 2019-12-20 22:00:08.177
|||||
|||||
031................. 1 Low A2 52.23 2019-12-19 22:00:08.177
031................. 1 Low A2 53.73 2019-12-20 22:00:08.177
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;AND Continues for the same host and for each TV and its LED's of 20.&lt;/P&gt;

&lt;P&gt;Now I need to calculate the percentage difference of LED 1 2..till..19 for each TV ( A1 ---A24) and raise and Alert for any LED's if they drop by 5%.&lt;/P&gt;

&lt;P&gt;This is the Splunk query I use:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="c:\\program files (x86)\\prysm\\servo\\logs\\vegaservo.log" "PLogger" earliest=-7d@d latest=now TV PA = Low  | stats max(VAL) as max_val by host, TILE, Laser, PA , _time | fields host, TV, LED, PA ,max_val, _time |streamstats current=f  values(max_val) as prev_val by LED TV host| eval perc_diff=((max_val - prev_val)/((max_val + prev_val)/2)*100) | where perc_diff &amp;gt; 5
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Output for one host :&lt;/STRONG&gt;&lt;BR /&gt;
          Host :::::: TV  :::::::  LED::::::::   PA    :::::     Max_val   :::::   _time ::::   Perc_diff       :::::   prev_val&lt;BR /&gt;
DESKTOP-3S2CV0M ::::    E1  ::::: 16    ::::   Low  :::: &lt;STRONG&gt;30.354&lt;/STRONG&gt; :::::  2020-05-06 10:00:46.221 ::::  5.136 ::::: &lt;STRONG&gt;28.834&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Cross Checking host data for the week:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;11 May 2020 05:00:46,276 [4] INFO  PLogger : TV = E1, Laser = 16, PA = Low, VAL = 31.512 
10 May 2020 05:00:46,211 [11] INFO  PLogger : TV = E1, LED = 16, PA = Low, VAL = 30.124 
09 May 2020 05:00:46,227 [10] INFO  PLogger : TV= E1, LED= 16, PA = Low, VAL = 30.695 
08 May 2020 05:00:46,307 [11] INFO  PLogger : TV = E1, LED = 16, PA = Low, VAL = 28.731 
07 May 2020 05:00:46,666 [5] INFO  PLogger - : TV = E1, LED = 16, PA = Low, VAL = 28.452 
06 May 2020 05:00:46,221 [16] INFO  PLogger -: TV = E1, LED= 16, PA = Low, VAL = **30.354** 
05 May 2020 05:00:47,196 [16] INFO  PLogger : TV= E1, LED = 16, PA = Low, VAL = **28.834** 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The problem here is, the value is only getting calculated between last 2 days as you can see the highlighted data above.&lt;/P&gt;

&lt;P&gt;I am stuck in how to get the alert correctly. How can I get the correct perc_diff alert for the week?&lt;/P&gt;</description>
    <pubDate>Wed, 30 Sep 2020 05:23:57 GMT</pubDate>
    <dc:creator>pkumar2</dc:creator>
    <dc:date>2020-09-30T05:23:57Z</dc:date>
    <item>
      <title>How to calculate the delta for same event for time difference of 7 days and alert if delta is more than 5%</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-delta-for-same-event-for-time-difference-of/m-p/496327#M138314</link>
      <description>&lt;P&gt;My Search has the below format data.&lt;/P&gt;

&lt;P&gt;A single host has multiple parameters consists of LED 1..to.20 for each TV and there are 24 TV's , The LED power paramerter has value say Max(val) 34.0 which is related to PA (power Amplitude) of Low/High, we only want search for PA = Low&lt;/P&gt;

&lt;P&gt;Query : &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="c:\\program files (x86)\\xxxx" "PLogger" TV earliest=-2d@d latest=now PA = Low | stats max(VAL) by host, TV, LED, PA , _time | fields "host" "LED","PA", "TV", "max(VAL)" |
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Result :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host LED PA TV Max (Val) _Time
03192610158 0 Low A1 48.863 2019-12-19 22:00:08.177
03192610158 0 Low A1 48.61 2019-12-20 22:00:08.140
031................. 1 Low A1 44.23 2019-12-19 22:00:08.177
031................. 1 Low A1 45.23 2019-12-20 22:00:08.177
|||||
|||||
031................. 19 Low A1 49.23 2019-12-19 22:00:08.177
031................. 19 Low A1 50.23 2019-12-20 22:00:08.177
|||||
|||||
031................. 1 Low A2 52.23 2019-12-19 22:00:08.177
031................. 1 Low A2 53.73 2019-12-20 22:00:08.177
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;AND Continues for the same host and for each TV and its LED's of 20.&lt;/P&gt;

&lt;P&gt;Now I need to calculate the percentage difference of LED 1 2..till..19 for each TV ( A1 ---A24) and raise and Alert for any LED's if they drop by 5%.&lt;/P&gt;

&lt;P&gt;This is the Splunk query I use:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="c:\\program files (x86)\\prysm\\servo\\logs\\vegaservo.log" "PLogger" earliest=-7d@d latest=now TV PA = Low  | stats max(VAL) as max_val by host, TILE, Laser, PA , _time | fields host, TV, LED, PA ,max_val, _time |streamstats current=f  values(max_val) as prev_val by LED TV host| eval perc_diff=((max_val - prev_val)/((max_val + prev_val)/2)*100) | where perc_diff &amp;gt; 5
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Output for one host :&lt;/STRONG&gt;&lt;BR /&gt;
          Host :::::: TV  :::::::  LED::::::::   PA    :::::     Max_val   :::::   _time ::::   Perc_diff       :::::   prev_val&lt;BR /&gt;
DESKTOP-3S2CV0M ::::    E1  ::::: 16    ::::   Low  :::: &lt;STRONG&gt;30.354&lt;/STRONG&gt; :::::  2020-05-06 10:00:46.221 ::::  5.136 ::::: &lt;STRONG&gt;28.834&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Cross Checking host data for the week:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;11 May 2020 05:00:46,276 [4] INFO  PLogger : TV = E1, Laser = 16, PA = Low, VAL = 31.512 
10 May 2020 05:00:46,211 [11] INFO  PLogger : TV = E1, LED = 16, PA = Low, VAL = 30.124 
09 May 2020 05:00:46,227 [10] INFO  PLogger : TV= E1, LED= 16, PA = Low, VAL = 30.695 
08 May 2020 05:00:46,307 [11] INFO  PLogger : TV = E1, LED = 16, PA = Low, VAL = 28.731 
07 May 2020 05:00:46,666 [5] INFO  PLogger - : TV = E1, LED = 16, PA = Low, VAL = 28.452 
06 May 2020 05:00:46,221 [16] INFO  PLogger -: TV = E1, LED= 16, PA = Low, VAL = **30.354** 
05 May 2020 05:00:47,196 [16] INFO  PLogger : TV= E1, LED = 16, PA = Low, VAL = **28.834** 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The problem here is, the value is only getting calculated between last 2 days as you can see the highlighted data above.&lt;/P&gt;

&lt;P&gt;I am stuck in how to get the alert correctly. How can I get the correct perc_diff alert for the week?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 05:23:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-delta-for-same-event-for-time-difference-of/m-p/496327#M138314</guid>
      <dc:creator>pkumar2</dc:creator>
      <dc:date>2020-09-30T05:23:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the delta for same event for time difference of 7 days and alert if delta is more than 5%</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-delta-for-same-event-for-time-difference-of/m-p/496328#M138315</link>
      <description>&lt;PRE&gt;&lt;CODE&gt; source="c:\\program files (x86)\\prysm\\servo\\logs\\vegaservo.log" "PLogger" earliest=-7d@d latest=now TV PA = Low  | bin _time span=1d | stats max(VAL) as max_val by host, TILE, Laser, PA , _time | fields host, TV, LED, PA ,max_val, _time  |streamstats current=f  last(max_val) as prev_val by LED TV host| eval perc_diff=((max_val - prev_val)/((max_val + prev_val)/2)*100) 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;check this result&lt;/P&gt;</description>
      <pubDate>Fri, 15 May 2020 22:18:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-delta-for-same-event-for-time-difference-of/m-p/496328#M138315</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-05-15T22:18:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the delta for same event for time difference of 7 days and alert if delta is more than 5%</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-delta-for-same-event-for-time-difference-of/m-p/496329#M138316</link>
      <description>&lt;P&gt;I tried it , It is taking only max and min of last 1 day and computing it.&lt;/P&gt;

&lt;P&gt;What is needed is &lt;STRONG&gt;Max and Min value reported for the week for each LED&lt;/STRONG&gt;. and perform the perc_diff calculation.&lt;/P&gt;</description>
      <pubDate>Sat, 16 May 2020 07:06:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-delta-for-same-event-for-time-difference-of/m-p/496329#M138316</guid>
      <dc:creator>pkumar2</dc:creator>
      <dc:date>2020-05-16T07:06:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the delta for same event for time difference of 7 days and alert if delta is more than 5%</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-delta-for-same-event-for-time-difference-of/m-p/496330#M138317</link>
      <description>&lt;P&gt;use &lt;CODE&gt;eventstats&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 16 May 2020 07:21:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-delta-for-same-event-for-time-difference-of/m-p/496330#M138317</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-05-16T07:21:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the delta for same event for time difference of 7 days and alert if delta is more than 5%</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-delta-for-same-event-for-time-difference-of/m-p/496331#M138318</link>
      <description>&lt;P&gt;Just tried this , source="c:\program files (x86)\prysm\servo\logs\vegaservo.log" "PLogger `&lt;/P&gt;

&lt;P&gt;" earliest=-7d@d latest=now TV PA = Low   | eventstats max(VAL) as max_val min(VAL) as min_val by host, TILE, Laser, PA , _time&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;16 May 2020 05:01:32,798 [13] INFO  PcalLogger - LaserNits: TV = C3, LED= 17, PA = Low, VAL = 49.138 
16 May 2020 05:01:33,825 [30] INFO  PcalLogger - LaserNits: TV = C3, LED = 17, PA = Low, VAL = 40.388 
16 May 2020 07:31:29,563 [13] INFO  PcalLogger - LaserNits: TV = C3, LED = 17, PA = Low, VAL = 42.771 
16 May 2020 05:01:26,504 [18] INFO  PcalLogger - LaserNits: TV = C3, LED = 17, PA = Low, VAL = 40.617 
16 May 2020 06:01:17,954 [28] INFO  PcalLogger - LaserNits: TV = C3, LED = 17, PA = Low, VAL = 56.235 
16 May 2020 05:02:48,667 [13] INFO  PcalLogger - LaserNits: TV = C3, LED= 17, PA = Low, VAL = 49.563 
16 May 2020 05:01:55,969 [13] INFO  PcalLogger - LaserNits: TV = C3, LED = 17, PA = Low, VAL = 49.563 
15 May 2020 05:02:13,664 [11] INFO  PcalLogger - LaserNits: TV = C3, LED = 17, PA = Low, VAL = 56.425 
15 May 2020 05:02:01,916 [8] INFO  PcalLogger - LaserNits: TV= C3, LED = 17, PA = Low, VAL = 54.894 
15 May 2020 05:01:42,815 [15] INFO  PcalLogger - LaserNits: TV = C3, LED = 17, PA = Low, VAL = 58.274 
15 May 2020 05:01:33,853 [21] INFO  PcalLogger - LaserNits: TV = C3, LED= 17, PA = Low, VAL = 56.425 
15 May 2020 05:01:47,114 [4] INFO  PcalLogger - LaserNits: TV = C3, LED= 17, PA = Low, VAL = 49.393 
15 May 2020 05:01:39,954 [11] INFO  PcalLogger - LaserNits: TV = C3, LED = 17, PA = Low, VAL = 47.566 
15 May 2020 05:01:32,599 [17] INFO  PcalLogger - LaserNits: TV = C3, LED = 17, PA = Low, VAL = 36.822 
15 May 2020 05:01:37,341 [20] INFO  PcalLogger - LaserNits: TV = C3, LED= 17, PA = Low, VAL = 49.028 
15 May 2020 05:01:31,575 [13] INFO  PcalLogger - LaserNits: TV = C3, LED = 17, PA = Low, VAL = 49.627 
15 May 2020 10:11:12,863 [10] INFO  PcalLogger - LaserNits: TV = C3, LED = 17, PA = Low, VAL = 36.742 
15 May 2020 05:01:33,639 [21] INFO  PcalLogger - LaserNits: TV = C3, LED= 17, PA = Low, VAL = 40.457 
15 May 2020 07:31:30,474 [12] INFO  PcalLogger - LaserNits: TV = C3, LED = 17, PA = Low, VAL = 42.566 
15 May 2020 05:01:26,318 [13] INFO  PcalLogger - LaserNits: TV = C3, LED = 17, PA = Low, VAL = 40.594 
15 May 2020 06:01:18,128 [29] INFO  PcalLogger - LaserNits: TV = C3, LED = 17, PA = Low, VAL = 56.145 
15 May 2020 05:01:43,558 [18] INFO  PcalLogger - LaserNits: TV= C3, LED = 17, PA = Low, VAL = 53.515 
14 May 2020 05:02:22,486 [26] INFO  PcalLogger - LaserNits: TV = C3, LED = 17, PA = Low, VAL = 48.056 
14 May 2020 05:01:43,976 [4] INFO  PcalLogger - LaserNits: TV = C3, LED = 17, PA = Low, VAL = 58.351 
14 May 2020 05:01:41,404 [26] INFO  PcalLogger - LaserNits: TV = C3, LED = 17, PA = Low, VAL = 48.056 
14 May 2020 05:01:33,721 [11] INFO  PcalLogger - LaserNits: TV = C3, LED = 17, PA = Low, VAL = 57.254 
14 May 2020 05:01:48,204 [23] INFO  PcalLogger - LaserNits: TV = C3, LED = 17, PA = Low, VAL = 49.906 
14 May 2020 05:01:38,857 [15] INFO  PcalLogger - LaserNits: TV = C3, LED = 17, PA = Low, VAL = 47.89 
14 May 2020 05:01:28,036 [19] INFO  PcalLogger - LaserNits: TV = C3, LED = 17, PA = Low, VAL = 36.776 
14 May 2020 05:01:38,073 [19] INFO  PcalLogger - LaserNits: TV = C3, LED = 17, PA = Low, VAL = 49.041 
14 May 2020 05:01:26,628 [11] INFO  PcalLogger - LaserNits: TV = C3, LED = 17, PA = Low, VAL = 49.871 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I tried |stats values(max_val) as max_val, values(min_val) as min_val  -- The Max and Min value for each LED for the week as a stats not able to get it. What am i doing wrong here.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 05:25:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-delta-for-same-event-for-time-difference-of/m-p/496331#M138318</guid>
      <dc:creator>pkumar2</dc:creator>
      <dc:date>2020-09-30T05:25:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the delta for same event for time difference of 7 days and alert if delta is more than 5%</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-delta-for-same-event-for-time-difference-of/m-p/496332#M138319</link>
      <description>&lt;P&gt;&lt;CODE&gt;by _time&lt;/CODE&gt; is each day, Don't you want a week's maximum?&lt;/P&gt;</description>
      <pubDate>Sat, 16 May 2020 10:28:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-delta-for-same-event-for-time-difference-of/m-p/496332#M138319</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-05-16T10:28:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the delta for same event for time difference of 7 days and alert if delta is more than 5%</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-delta-for-same-event-for-time-difference-of/m-p/496333#M138320</link>
      <description>&lt;P&gt;yes, want the week maximum and minimum per LED and get the percentage difference.&lt;/P&gt;</description>
      <pubDate>Sat, 16 May 2020 10:48:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-delta-for-same-event-for-time-difference-of/m-p/496333#M138320</guid>
      <dc:creator>pkumar2</dc:creator>
      <dc:date>2020-05-16T10:48:44Z</dc:date>
    </item>
  </channel>
</rss>

