<?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: How to use the value of a dynamic threshold constructed as a result of a search to create a alert ? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-value-of-a-dynamic-threshold-constructed-as-a/m-p/388749#M113356</link>
    <description>&lt;P&gt;That worked. Thank you.&lt;/P&gt;</description>
    <pubDate>Tue, 16 Jul 2019 15:06:20 GMT</pubDate>
    <dc:creator>vallurupallic</dc:creator>
    <dc:date>2019-07-16T15:06:20Z</dc:date>
    <item>
      <title>How to use the value of a dynamic threshold constructed as a result of a search to create a alert ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-value-of-a-dynamic-threshold-constructed-as-a/m-p/388745#M113352</link>
      <description>&lt;P&gt;The following splunk search is what I'm using to construct the dynamic threshold of a alert I want to create:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=my_sourceearliest=-28d 
| eval dayofweek = strftime(_time,"%A")
| eval today=strftime(now(),"%A")
| eval eventHour=strftime(_time,"%H") 
| eval eventMin=strftime(_time,"%M")
| eval curHour=strftime(now(),"%H") 
| eval curMin=strftime(now(),"%M")
| where dayofweek=today AND  eventHour=curHour AND curMin &amp;gt; eventMin AND (eventMin &amp;gt; curMin-5) 
| bucket _time span=1d
| stats count by _time 
| stats avg(count) as dynThreshold | eval dynThreshold=(1.3*dynThreshold)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now I want to create a alert where the result count is greater than the dynThreshold value constructed above. can someone help with this please.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jul 2019 20:44:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-value-of-a-dynamic-threshold-constructed-as-a/m-p/388745#M113352</guid>
      <dc:creator>vallurupallic</dc:creator>
      <dc:date>2019-07-15T20:44:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the value of a dynamic threshold constructed as a result of a search to create a alert ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-value-of-a-dynamic-threshold-constructed-as-a/m-p/388746#M113353</link>
      <description>&lt;P&gt;try this anywhere:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| gentimes start=-28 increment=1h
| eval _time = starttime
| eval random_value = random()%200
| eval dayofweek = strftime(_time,"%A")
| eval today=strftime(now(),"%A")
| eval eventHour=strftime(_time,"%H") 
| eval eventMin=strftime(_time,"%M")
| eval curHour=strftime(now(),"%H") 
| eval curMin=strftime(now(),"%M")
| where dayofweek=$today$ AND  eventHour=curHour AND curMin &amp;gt; eventMin AND (eventMin &amp;gt; curMin-15) 
| bucket _time span=1d
| stats avg(random_value) as avg_ran by _time
| eventstats avg(avg_ran) as dynThreshold
| eval dynThreshold=(1.3*dynThreshold)
| eval alert = if(avg_ran &amp;gt; dynZThreshold,1,0)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;i changed &lt;CODE&gt;... AND (eventMin &amp;gt; curMin-5&lt;/CODE&gt; to &lt;CODE&gt;... &amp;gt; curMin-15&lt;/CODE&gt; to make sure you will see results&lt;/P&gt;

&lt;P&gt;hope it helps&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jul 2019 00:11:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-value-of-a-dynamic-threshold-constructed-as-a/m-p/388746#M113353</guid>
      <dc:creator>adonio</dc:creator>
      <dc:date>2019-07-16T00:11:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the value of a dynamic threshold constructed as a result of a search to create a alert ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-value-of-a-dynamic-threshold-constructed-as-a/m-p/388747#M113354</link>
      <description>&lt;P&gt;im trying to substitute the use of random value above with the search query result set. But im not able to find any results. I tried the search query just after gentimes as gentimes need to be the first command. can you help please&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jul 2019 14:44:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-value-of-a-dynamic-threshold-constructed-as-a/m-p/388747#M113354</guid>
      <dc:creator>vallurupallic</dc:creator>
      <dc:date>2019-07-16T14:44:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the value of a dynamic threshold constructed as a result of a search to create a alert ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-value-of-a-dynamic-threshold-constructed-as-a/m-p/388748#M113355</link>
      <description>&lt;P&gt;the &lt;CODE&gt;| gentimes&lt;/CODE&gt; is an example&lt;BR /&gt;
 use your search &lt;/P&gt;

&lt;P&gt;sourcetype=my_sourceearliest=-28d &lt;BR /&gt;
 | eval dayofweek = strftime(_time,"%A")&lt;BR /&gt;
 | eval today=strftime(now(),"%A")&lt;BR /&gt;
 | eval eventHour=strftime(_time,"%H") &lt;BR /&gt;
 | eval eventMin=strftime(_time,"%M")&lt;BR /&gt;
 | eval curHour=strftime(now(),"%H") &lt;BR /&gt;
 | eval curMin=strftime(now(),"%M")&lt;BR /&gt;
 | where dayofweek=today AND  eventHour=curHour AND curMin &amp;gt; eventMin AND (eventMin &amp;gt; curMin-5) &lt;BR /&gt;
 | bucket _time span=1d&lt;BR /&gt;
 | stats count as tot_count by _time &lt;BR /&gt;
 | eventstats avg(tot_count) as dynThreshold&lt;BR /&gt;
 | eval dynThreshold=(1.3*dynThreshold)&lt;BR /&gt;
 | eval alert = if(tot_count &amp;gt; dynZThreshold,1,0)&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:19:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-value-of-a-dynamic-threshold-constructed-as-a/m-p/388748#M113355</guid>
      <dc:creator>adonio</dc:creator>
      <dc:date>2020-09-30T01:19:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the value of a dynamic threshold constructed as a result of a search to create a alert ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-value-of-a-dynamic-threshold-constructed-as-a/m-p/388749#M113356</link>
      <description>&lt;P&gt;That worked. Thank you.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jul 2019 15:06:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-value-of-a-dynamic-threshold-constructed-as-a/m-p/388749#M113356</guid>
      <dc:creator>vallurupallic</dc:creator>
      <dc:date>2019-07-16T15:06:20Z</dc:date>
    </item>
  </channel>
</rss>

