<?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: Alert based on evaluating two time ranges in Alerting</title>
    <link>https://community.splunk.com/t5/Alerting/Alert-based-on-evaluating-two-time-ranges/m-p/53114#M720</link>
    <description>&lt;P&gt;In the TimeRangePicker,  choose 'custom time',  then go to 'advanced'. &lt;/P&gt;

&lt;P&gt;Enter the following as your timerange. &lt;/P&gt;

&lt;P&gt;earliest = &lt;CODE&gt;-20min@min&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;latest = &lt;CODE&gt;-10min@min&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;And here's a search that will work: &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;&amp;lt;your search terms&amp;gt; | eval period=if(_time&amp;lt;relative_time(now(), "-15min@min"),"older_period", "recent_period") | eval foo=1 | chart avg(field1) over foo by period | eval diff = (recent_period-older_period)*100/older_period | where diff&amp;gt;X&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Then save the search, click the 'schedule this search' box,  and tell splunkd that if the search returns 1 or more rows, that you want it to send you an email. &lt;/P&gt;

&lt;P&gt;here's another different search that will work too, although you have to use the same timerange&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;&amp;lt;your search terms&amp;gt; | timechart avg(field1) as avg span=5min | transpose | search column=avg | rename "row 1" as "older_period" | rename "row 2" as "recent_period" | eval diff = (recent_period-older_period)*100/older_period | where diff&amp;gt;X&lt;/CODE&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 03 Mar 2011 15:50:49 GMT</pubDate>
    <dc:creator>sideview</dc:creator>
    <dc:date>2011-03-03T15:50:49Z</dc:date>
    <item>
      <title>Alert based on evaluating two time ranges</title>
      <link>https://community.splunk.com/t5/Alerting/Alert-based-on-evaluating-two-time-ranges/m-p/53113#M719</link>
      <description>&lt;P&gt;I am trying to send alerts based on the following criteria:&lt;/P&gt;

&lt;P&gt;Last 15-20 mins: Measure avg(field1) --&amp;gt; value1
Last 10-15 mins: Measure avg(field1) --&amp;gt; value2&lt;/P&gt;

&lt;P&gt;Calculate the % change between value1 and value2:&lt;/P&gt;

&lt;P&gt;diff = (value2-value1)*100/value1&lt;/P&gt;

&lt;P&gt;If diff is more than X percent than I need to send an alert notification.&lt;/P&gt;

&lt;P&gt;How can I do this in one search command?&lt;/P&gt;</description>
      <pubDate>Thu, 03 Mar 2011 14:30:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Alert-based-on-evaluating-two-time-ranges/m-p/53113#M719</guid>
      <dc:creator>nbharadwaj</dc:creator>
      <dc:date>2011-03-03T14:30:52Z</dc:date>
    </item>
    <item>
      <title>Re: Alert based on evaluating two time ranges</title>
      <link>https://community.splunk.com/t5/Alerting/Alert-based-on-evaluating-two-time-ranges/m-p/53114#M720</link>
      <description>&lt;P&gt;In the TimeRangePicker,  choose 'custom time',  then go to 'advanced'. &lt;/P&gt;

&lt;P&gt;Enter the following as your timerange. &lt;/P&gt;

&lt;P&gt;earliest = &lt;CODE&gt;-20min@min&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;latest = &lt;CODE&gt;-10min@min&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;And here's a search that will work: &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;&amp;lt;your search terms&amp;gt; | eval period=if(_time&amp;lt;relative_time(now(), "-15min@min"),"older_period", "recent_period") | eval foo=1 | chart avg(field1) over foo by period | eval diff = (recent_period-older_period)*100/older_period | where diff&amp;gt;X&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Then save the search, click the 'schedule this search' box,  and tell splunkd that if the search returns 1 or more rows, that you want it to send you an email. &lt;/P&gt;

&lt;P&gt;here's another different search that will work too, although you have to use the same timerange&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;&amp;lt;your search terms&amp;gt; | timechart avg(field1) as avg span=5min | transpose | search column=avg | rename "row 1" as "older_period" | rename "row 2" as "recent_period" | eval diff = (recent_period-older_period)*100/older_period | where diff&amp;gt;X&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Mar 2011 15:50:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Alert-based-on-evaluating-two-time-ranges/m-p/53114#M720</guid>
      <dc:creator>sideview</dc:creator>
      <dc:date>2011-03-03T15:50:49Z</dc:date>
    </item>
  </channel>
</rss>

