<?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 Dynamic Threshold Calculation in splunk alert in Alerting</title>
    <link>https://community.splunk.com/t5/Alerting/Dynamic-Threshold-Calculation-in-splunk-alert/m-p/456843#M8109</link>
    <description>&lt;P&gt;I have market data feed indexing into splunk. &lt;/P&gt;

&lt;P&gt;The logs look like following -&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Security: "HDFC", FIELDS: {"PRICE", "ASK", "HIGH"}, receivedTime: &amp;lt;time-string&amp;gt;
Security "YESBANK", FIELDS= {"PRICE", "HIGH"}, receivedTime: &amp;lt;time-string&amp;gt;
Security: "HDFC", FIELDS: {"ASK", "HIGH"}, receivedTime: &amp;lt;time-string&amp;gt;
Security: "HDFC", FIELDS: {"PRICE"}, receivedTime: &amp;lt;time-string&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Security:&lt;/STRONG&gt; a single value filed&lt;BR /&gt;
&lt;STRONG&gt;FIELDS:&lt;/STRONG&gt; a &lt;EM&gt;multi value field&lt;/EM&gt;&lt;BR /&gt;
&lt;STRONG&gt;receivedTime:&lt;/STRONG&gt; sting, can be different from _time&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;There are close to 5000 Securities log in daily. &lt;/LI&gt;
&lt;LI&gt;It's about 10 GB of license usage per day. So it's a large number of events.&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;&lt;STRONG&gt;We want to calculate the SECUIRTY:FIELD pairs that are logging less frequency than their usual input frequency.&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;so, for a SECURITY:FIELD pair - &lt;/P&gt;

&lt;P&gt;diff_time = recievedTime (previous) - receivedTime (current)&lt;/P&gt;

&lt;P&gt;this diff time varies from each SECURITY:FIELD pair from other. Some log in every second, others log in only once a day.&lt;/P&gt;

&lt;P&gt;The challenge is to come up with an alert/alerts that dynamically calculates the optimum frequency (diff_time) for each SECURITY:FIELD pair and then compares it with it's current value. &lt;/P&gt;

&lt;P&gt;Now let's say we assume that an optimum frequency will be the average of last 7 frequency of inputs of same SECURITY:FIELD pair.&lt;BR /&gt;
In order calculate this value I will have to run the query for last 7 days (cause some log only once a day), and with large amount of data and use of mvexpand command, this is not viable.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;How do you suggest I achieve this goal? Please suggest an algorithm for it.&lt;/STRONG&gt;&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;I can't use a lookup table cause of it's size issue. A large burst of input data will bring down whole splunk if lookup table grows wildly.&lt;/LI&gt;
&lt;/UL&gt;</description>
    <pubDate>Thu, 16 May 2019 17:27:05 GMT</pubDate>
    <dc:creator>iparitosh</dc:creator>
    <dc:date>2019-05-16T17:27:05Z</dc:date>
    <item>
      <title>Dynamic Threshold Calculation in splunk alert</title>
      <link>https://community.splunk.com/t5/Alerting/Dynamic-Threshold-Calculation-in-splunk-alert/m-p/456843#M8109</link>
      <description>&lt;P&gt;I have market data feed indexing into splunk. &lt;/P&gt;

&lt;P&gt;The logs look like following -&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Security: "HDFC", FIELDS: {"PRICE", "ASK", "HIGH"}, receivedTime: &amp;lt;time-string&amp;gt;
Security "YESBANK", FIELDS= {"PRICE", "HIGH"}, receivedTime: &amp;lt;time-string&amp;gt;
Security: "HDFC", FIELDS: {"ASK", "HIGH"}, receivedTime: &amp;lt;time-string&amp;gt;
Security: "HDFC", FIELDS: {"PRICE"}, receivedTime: &amp;lt;time-string&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Security:&lt;/STRONG&gt; a single value filed&lt;BR /&gt;
&lt;STRONG&gt;FIELDS:&lt;/STRONG&gt; a &lt;EM&gt;multi value field&lt;/EM&gt;&lt;BR /&gt;
&lt;STRONG&gt;receivedTime:&lt;/STRONG&gt; sting, can be different from _time&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;There are close to 5000 Securities log in daily. &lt;/LI&gt;
&lt;LI&gt;It's about 10 GB of license usage per day. So it's a large number of events.&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;&lt;STRONG&gt;We want to calculate the SECUIRTY:FIELD pairs that are logging less frequency than their usual input frequency.&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;so, for a SECURITY:FIELD pair - &lt;/P&gt;

&lt;P&gt;diff_time = recievedTime (previous) - receivedTime (current)&lt;/P&gt;

&lt;P&gt;this diff time varies from each SECURITY:FIELD pair from other. Some log in every second, others log in only once a day.&lt;/P&gt;

&lt;P&gt;The challenge is to come up with an alert/alerts that dynamically calculates the optimum frequency (diff_time) for each SECURITY:FIELD pair and then compares it with it's current value. &lt;/P&gt;

&lt;P&gt;Now let's say we assume that an optimum frequency will be the average of last 7 frequency of inputs of same SECURITY:FIELD pair.&lt;BR /&gt;
In order calculate this value I will have to run the query for last 7 days (cause some log only once a day), and with large amount of data and use of mvexpand command, this is not viable.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;How do you suggest I achieve this goal? Please suggest an algorithm for it.&lt;/STRONG&gt;&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;I can't use a lookup table cause of it's size issue. A large burst of input data will bring down whole splunk if lookup table grows wildly.&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Thu, 16 May 2019 17:27:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Dynamic-Threshold-Calculation-in-splunk-alert/m-p/456843#M8109</guid>
      <dc:creator>iparitosh</dc:creator>
      <dc:date>2019-05-16T17:27:05Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Threshold Calculation in splunk alert</title>
      <link>https://community.splunk.com/t5/Alerting/Dynamic-Threshold-Calculation-in-splunk-alert/m-p/456844#M8110</link>
      <description>&lt;P&gt;you probably need to use a dynamic outlier model. try using this -  &lt;A href="https://docs.splunk.com/Documentation/MLApp/4.2.0/User/DNOlegacyassist"&gt;https://docs.splunk.com/Documentation/MLApp/4.2.0/User/DNOlegacyassist&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 18 May 2019 15:23:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Dynamic-Threshold-Calculation-in-splunk-alert/m-p/456844#M8110</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2019-05-18T15:23:25Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Threshold Calculation in splunk alert</title>
      <link>https://community.splunk.com/t5/Alerting/Dynamic-Threshold-Calculation-in-splunk-alert/m-p/456845#M8111</link>
      <description>&lt;P&gt;Thank you for your response. I am reading more about it to check if it cam solve my problem.&lt;/P&gt;</description>
      <pubDate>Mon, 20 May 2019 21:07:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Dynamic-Threshold-Calculation-in-splunk-alert/m-p/456845#M8111</guid>
      <dc:creator>iparitosh</dc:creator>
      <dc:date>2019-05-20T21:07:41Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Threshold Calculation in splunk alert</title>
      <link>https://community.splunk.com/t5/Alerting/Dynamic-Threshold-Calculation-in-splunk-alert/m-p/456846#M8112</link>
      <description>&lt;P&gt;Hi @iparitosh,&lt;/P&gt;

&lt;P&gt;Your algorithm should be something like this :&lt;BR /&gt;
1- Fetch all the data you need --&amp;gt; &lt;CODE&gt;index=yourindex sourcetype=yoursourcetype filter=yourfilter&lt;/CODE&gt;&lt;BR /&gt;
2- Make sure your multi value field is extracted, either via props/transforms or using &lt;CODE&gt;rex&lt;/CODE&gt; command the &lt;CODE&gt;max_match&lt;/CODE&gt; option.&lt;BR /&gt;
more info here &lt;A href="https://docs.splunk.com/Documentation/Splunk/7.2.6/SearchReference/Rex"&gt;https://docs.splunk.com/Documentation/Splunk/7.2.6/SearchReference/Rex&lt;/A&gt;&lt;BR /&gt;
3- To avoid using &lt;CODE&gt;mvexpand&lt;/CODE&gt; for that multi-value field run a stats command to convert your data into tabular form :&lt;BR /&gt;
...|stats values(requiredFields) as requiredFields by SECURITY,FIELD,RECEIVEDTIME&lt;BR /&gt;
4- Once you have that table use it for calculating the delta and frequency, shouldn't be too resource intensive at this point anymore.&lt;/P&gt;

&lt;P&gt;Cheers,&lt;BR /&gt;
David&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2019 05:50:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Dynamic-Threshold-Calculation-in-splunk-alert/m-p/456846#M8112</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2019-05-21T05:50:56Z</dc:date>
    </item>
  </channel>
</rss>

