<?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: Possibly to alert based on previous sample comparison in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Possibly-to-alert-based-on-previous-sample-comparison/m-p/692216#M235637</link>
    <description>&lt;P&gt;That's why my solution uses addinfo which gives you the "earliest" and "latest" times from the timepicker&lt;/P&gt;</description>
    <pubDate>Tue, 02 Jul 2024 14:35:20 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2024-07-02T14:35:20Z</dc:date>
    <item>
      <title>Possibly to alert based on previous sample comparison</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Possibly-to-alert-based-on-previous-sample-comparison/m-p/692193#M235632</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Put simply, I am trying to wrap my head around how I can configure an alert to trigger is a metric is X% higher or lower than the same metric, say 1 day ago.&lt;/P&gt;&lt;P&gt;So for example if I search&lt;BR /&gt;&lt;BR /&gt;index=my_index eventStatus=fault | stats count by eventStatus&lt;BR /&gt;&lt;BR /&gt;Searching "Last 15 minutes", giving say 100 results, can I trigger an alert IF the same search in the same 15 minute timeframe 1 day ago is for example 10% higher or lower?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2024 10:48:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Possibly-to-alert-based-on-previous-sample-comparison/m-p/692193#M235632</guid>
      <dc:creator>Silah</dc:creator>
      <dc:date>2024-07-02T10:48:32Z</dc:date>
    </item>
    <item>
      <title>Re: Possibly to alert based on previous sample comparison</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Possibly-to-alert-based-on-previous-sample-comparison/m-p/692197#M235633</link>
      <description>&lt;P&gt;If you search both time segments then work out which group the time belongs to, then compare the two&lt;/P&gt;&lt;P&gt;See this example&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=_audit (earliest=-1d@d latest=-1d@d+15m) OR (earliest=@d latest=@d+15m)
| eval group=if(_time&amp;gt;relative_time(now(),"@d"), "Prev", "Current")
| chart count over user by group
| eval alert=if(Current &amp;gt; Prev * 1.15, 1, 0)&lt;/LI-CODE&gt;&lt;P&gt;So this sets group according to where _time sits then just chart over user and calculate excess&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2024 11:53:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Possibly-to-alert-based-on-previous-sample-comparison/m-p/692197#M235633</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2024-07-02T11:53:02Z</dc:date>
    </item>
    <item>
      <title>Re: Possibly to alert based on previous sample comparison</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Possibly-to-alert-based-on-previous-sample-comparison/m-p/692198#M235634</link>
      <description>&lt;P&gt;Try something like this (note that if your time range spans midnight, then you will have to do something else with the bin _time)&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=my_index eventStatus=fault [| makeresults
    | eval row=mvrange(0,2) 
    | mvexpand row
    | addinfo
    | eval earliest=relative_time(info_min_time,(row*-1)."d")
    | eval latest=relative_time(info_max_time,(row*-1)."d")
    | table earliest latest]
| bin _time span=1d
| chart count by eventStatus _time
| foreach 1*
    [eval diff=if(isnull(diff),'&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;',abs((diff-'&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;')/diff))]
| where diff &amp;gt;0.15&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 02 Jul 2024 12:19:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Possibly-to-alert-based-on-previous-sample-comparison/m-p/692198#M235634</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-07-02T12:19:56Z</dc:date>
    </item>
    <item>
      <title>Re: Possibly to alert based on previous sample comparison</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Possibly-to-alert-based-on-previous-sample-comparison/m-p/692210#M235635</link>
      <description>&lt;P&gt;Thanks, I tried this but it only seems to list results that ocurred between 00:00 and 00:15 despite the search being "15 minutes ago"&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2024 13:57:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Possibly-to-alert-based-on-previous-sample-comparison/m-p/692210#M235635</guid>
      <dc:creator>Silah</dc:creator>
      <dc:date>2024-07-02T13:57:55Z</dc:date>
    </item>
    <item>
      <title>Re: Possibly to alert based on previous sample comparison</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Possibly-to-alert-based-on-previous-sample-comparison/m-p/692213#M235636</link>
      <description>&lt;P&gt;Thanks, this seem to be producing something like what I am looking for.&lt;/P&gt;&lt;P&gt;Can I ask, what is the significance of this? I don't really understand it&lt;/P&gt;&lt;PRE&gt;'&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;'&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2024 14:25:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Possibly-to-alert-based-on-previous-sample-comparison/m-p/692213#M235636</guid>
      <dc:creator>Silah</dc:creator>
      <dc:date>2024-07-02T14:25:19Z</dc:date>
    </item>
    <item>
      <title>Re: Possibly to alert based on previous sample comparison</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Possibly-to-alert-based-on-previous-sample-comparison/m-p/692216#M235637</link>
      <description>&lt;P&gt;That's why my solution uses addinfo which gives you the "earliest" and "latest" times from the timepicker&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2024 14:35:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Possibly-to-alert-based-on-previous-sample-comparison/m-p/692216#M235637</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-07-02T14:35:20Z</dc:date>
    </item>
    <item>
      <title>Re: Possibly to alert based on previous sample comparison</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Possibly-to-alert-based-on-previous-sample-comparison/m-p/692217#M235638</link>
      <description>&lt;P&gt;The foreach command goes through each field listed in the foreach command, in this instance, fieldnames beginning with 1 followed by anything. The time values are all epoch times, which are the number of seconds since the beginning of 1970. At present, these all start with 1. Eventually, in a about 9 years time, this will start with 2. So, within the subsearch of the foreach command (within the square brackets []), the &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; value in the subsearch is replaced by the field name from the list. Since, in this case, this is a number, the &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; is placed in single quotes '&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;' to tell Splunk that it is to be interpreted as a field name (not a number).&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2024 14:43:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Possibly-to-alert-based-on-previous-sample-comparison/m-p/692217#M235638</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-07-02T14:43:32Z</dc:date>
    </item>
  </channel>
</rss>

