<?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 Evaluate errors based on thresholds in Alerting</title>
    <link>https://community.splunk.com/t5/Alerting/Evaluate-errors-based-on-thresholds/m-p/461300#M8185</link>
    <description>&lt;P&gt;I have a requirement where my query has to capture the error from the logs,look for its respective Description and Comments from the lookup file and then after perform statistics based on the Comments&lt;/P&gt;
&lt;P&gt;Now what I want is,on comparing it with the lookup file threshold column,error &lt;STRONG&gt;ghf&lt;/STRONG&gt; count is &lt;STRONG&gt;250&lt;/STRONG&gt; and it exceeds the threshold,so its Comments should no longer be Medium,instead it has to be changed as &lt;STRONG&gt;High(Upgraded)&lt;/STRONG&gt;..&lt;/P&gt;
&lt;P&gt;Kindly let me know how to proceed with it.&lt;/P&gt;
&lt;P&gt;Thanks in advance!!&lt;/P&gt;</description>
    <pubDate>Tue, 09 Jun 2020 22:01:54 GMT</pubDate>
    <dc:creator>prettysunshinez</dc:creator>
    <dc:date>2020-06-09T22:01:54Z</dc:date>
    <item>
      <title>Evaluate errors based on thresholds</title>
      <link>https://community.splunk.com/t5/Alerting/Evaluate-errors-based-on-thresholds/m-p/461300#M8185</link>
      <description>&lt;P&gt;I have a requirement where my query has to capture the error from the logs,look for its respective Description and Comments from the lookup file and then after perform statistics based on the Comments&lt;/P&gt;
&lt;P&gt;Now what I want is,on comparing it with the lookup file threshold column,error &lt;STRONG&gt;ghf&lt;/STRONG&gt; count is &lt;STRONG&gt;250&lt;/STRONG&gt; and it exceeds the threshold,so its Comments should no longer be Medium,instead it has to be changed as &lt;STRONG&gt;High(Upgraded)&lt;/STRONG&gt;..&lt;/P&gt;
&lt;P&gt;Kindly let me know how to proceed with it.&lt;/P&gt;
&lt;P&gt;Thanks in advance!!&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jun 2020 22:01:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Evaluate-errors-based-on-thresholds/m-p/461300#M8185</guid>
      <dc:creator>prettysunshinez</dc:creator>
      <dc:date>2020-06-09T22:01:54Z</dc:date>
    </item>
    <item>
      <title>Re: Evaluate errors based on thresholds</title>
      <link>https://community.splunk.com/t5/Alerting/Evaluate-errors-based-on-thresholds/m-p/461301#M8186</link>
      <description>&lt;P&gt;You don't have a Comments column in your last lookup result.  Was that just an omission?&lt;/P&gt;</description>
      <pubDate>Mon, 30 Mar 2020 14:11:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Evaluate-errors-based-on-thresholds/m-p/461301#M8186</guid>
      <dc:creator>rmmiller</dc:creator>
      <dc:date>2020-03-30T14:11:10Z</dc:date>
    </item>
    <item>
      <title>Re: Evaluate errors based on thresholds</title>
      <link>https://community.splunk.com/t5/Alerting/Evaluate-errors-based-on-thresholds/m-p/461302#M8187</link>
      <description>&lt;P&gt;Another clarification:  For your example drill down when Comments="Medium" -- do you want that drill down to include Medium(Upgraded)"  also?  Or only the "native" Medium, regardless of Threshold violation?&lt;/P&gt;</description>
      <pubDate>Mon, 30 Mar 2020 15:01:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Evaluate-errors-based-on-thresholds/m-p/461302#M8187</guid>
      <dc:creator>rmmiller</dc:creator>
      <dc:date>2020-03-30T15:01:19Z</dc:date>
    </item>
    <item>
      <title>Re: Evaluate errors based on thresholds</title>
      <link>https://community.splunk.com/t5/Alerting/Evaluate-errors-based-on-thresholds/m-p/461303#M8188</link>
      <description>&lt;P&gt;So for the requirement was just to have the count Comments wise and on clicking the Comments,to display the error wise count.&lt;/P&gt;

&lt;P&gt;But now the requirement is to have like this at the first point itself.(For eg)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Comments count
High 60
Medium(Upgraded) 560
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Where in clicking the &lt;STRONG&gt;Medium(Upgraded)&lt;/STRONG&gt; should show me the list of errors which were &lt;STRONG&gt;Low&lt;/STRONG&gt; and has exceeded the threshold.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Mar 2020 15:04:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Evaluate-errors-based-on-thresholds/m-p/461303#M8188</guid>
      <dc:creator>prettysunshinez</dc:creator>
      <dc:date>2020-03-30T15:04:46Z</dc:date>
    </item>
    <item>
      <title>Re: Evaluate errors based on thresholds</title>
      <link>https://community.splunk.com/t5/Alerting/Evaluate-errors-based-on-thresholds/m-p/461304#M8189</link>
      <description>&lt;P&gt;Medium should show me the errors that are categorised as medium and that have not exceeded thier assigned threshold.&lt;/P&gt;

&lt;P&gt;Medium(Upgraded) should show me the errors that are categorised as low and that have exceeded thier assigned threshold&lt;/P&gt;</description>
      <pubDate>Mon, 30 Mar 2020 15:07:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Evaluate-errors-based-on-thresholds/m-p/461304#M8189</guid>
      <dc:creator>prettysunshinez</dc:creator>
      <dc:date>2020-03-30T15:07:20Z</dc:date>
    </item>
    <item>
      <title>Re: Evaluate errors based on thresholds</title>
      <link>https://community.splunk.com/t5/Alerting/Evaluate-errors-based-on-thresholds/m-p/461305#M8190</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Your base search:&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index = &amp;lt;details of your search&amp;gt;
| regular expression to catch error max_match=0
| mvexpand error
| lookup lookupfile_name error outputs Description Comments Threshold
| stats count BY Description,Threshold,Comments
| eval Comments = case(count &amp;gt; Threshold AND lower(Comments)=="high","Critical(Upgraded)",count &amp;gt; Threshold AND lower(Comments)=="medium","High(Upgraded)",count &amp;gt; Threshold AND lower(Comments)=="Low","Medium(Upgraded)",1==1,Comments)
| table Comments,count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You need to include the threshold value as output from your lookup command then compare the counts against the threshold.  Unfortunately, you have to build your own translation from one value of Comments to the next (upgraded), but we can do that with the eval / case command.&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;Note:  I took the liberty of adding some insurance against your Comments fields maybe not always having the correct Capitalization.&lt;/EM&gt;&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;&lt;STRONG&gt;Step 1:&lt;/STRONG&gt;  Change your lookup command to include the threshold value:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| lookup lookupfile_name error outputs Description Comments Threshold
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Note I've included "Threshold" as an output field.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Step 2:&lt;/STRONG&gt;  Use stats to compute the count per Name, Comments and Threshold&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats count BY Description,Comments,Threshold
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will tally all the errors up, split by Name, Comments, and Threshold.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Step 3:&lt;/STRONG&gt;  Compare each count against the Threshold value:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval Comments = case(count &amp;gt; Threshold AND lower(Comments)=="high","Critical(Upgraded)",count &amp;gt; Threshold AND lower(Comments)=="medium","High(Upgraded)",count &amp;gt; Threshold AND lower(Comments)=="low","Medium(Upgraded)",1==1,Comments)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This command upgrades the Comments value if the count is greater than the Threshold value.  If count is equal to or less than Threshold, there is no change in the value of &lt;EM&gt;Comments&lt;/EM&gt;.  &lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Step 4:&lt;/STRONG&gt;  Display the interested fields in a table showing the Comments and count:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| table Comments,count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;H2&gt;This just displays the Comments and count fields in a table, from which you can click to drill down to your next search.  Doing another stats count here will yield incorrect results.  You have already run stats, so just show the interested fields.&lt;/H2&gt;

&lt;P&gt;&lt;STRONG&gt;Your drill down search:&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;You are pretty close with your attempt; you just need to add in the logic that addresses the threshold violations.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index = &amp;lt;details of your search&amp;gt;
| regular expression to catch error max_match=0
| mvexpand error
| lookup lookupfile_name error outputs Description Comments Threshold
| stats count BY Description,Threshold,Comments
| eval Comments = case(count &amp;gt; Threshold AND lower(Comments)=="high","Critical(Upgraded)",count &amp;gt; Threshold AND lower(Comments)=="medium","High(Upgraded)",count &amp;gt; Threshold AND lower(Comments)=="Low","Medium(Upgraded)",1==1,Comments)
| search Comments=$selectedcomment|s$
| table Description,count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;H2&gt;This assumes your drill down token is named &lt;EM&gt;selectedcomment&lt;/EM&gt;.  Note there's a pipe and an extra s here -- it tells Splunk to put double quotes around the value of this variable when running the search as a drill down.&lt;/H2&gt;

&lt;H2&gt;Mocked-up Data&lt;/H2&gt;

&lt;HR /&gt;

&lt;P&gt;Some run anywhere SPL to help make sense of this using randomly-generated data is below.  You can ignore this unless you want to learn more about how this works.  Sometimes you might get no results, but it's only because of the randomness.  Remove the search clause to validate the logic, if interested.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults count=50
| eval raw=split("SplunkForwarder,SMTP_Server,WWW_Publishing,Server,Workstation",",")
| eval comm=split("Low,Medium,High,Low",",")
| eval thold=split("15,10,5,10",",")
| eval Random = random()%4
| eval Description=mvindex(raw,Random)
| eval Comments=mvindex(comm,Random)
| eval Threshold=mvindex(thold,Random)
| fields - raw,comm,Random,thold
| stats count BY Description,Threshold,Comments
| eval Comments = case(count &amp;gt; Threshold AND lower(Comments)=="high","Critical(Upgraded)",count &amp;gt; Threshold AND lower(Comments)=="medium","High(Upgraded)",count &amp;gt; Threshold AND lower(Comments)=="low","Medium(Upgraded)",1==1,Comments)
| search Comments="High(Upgraded)"
| table Description,count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;HR /&gt;

&lt;P&gt;Hope that helps!&lt;/P&gt;

&lt;P&gt;rmmiller&lt;/P&gt;</description>
      <pubDate>Mon, 30 Mar 2020 16:52:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Evaluate-errors-based-on-thresholds/m-p/461305#M8190</guid>
      <dc:creator>rmmiller</dc:creator>
      <dc:date>2020-03-30T16:52:37Z</dc:date>
    </item>
    <item>
      <title>Re: Evaluate errors based on thresholds</title>
      <link>https://community.splunk.com/t5/Alerting/Evaluate-errors-based-on-thresholds/m-p/461306#M8191</link>
      <description>&lt;P&gt;Change your first query to:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Index =  | regular expression to catch error max_match=0 | mvexpand error | lookup lookupfile_name error outputs Description, Comments, Threshold  | stats count by Description, Comments, Threshold | eval Comments=case(Comments == "High" AND count &amp;gt; Threshold,  "Critical(Upgraded)", Comments == "Medium" AND count &amp;gt; Threshold, "High(Upgraded)", Comments == "Low" AND count &amp;gt; Threshold, "Medium(Upgraded)", 1==1, component) | stats count by Comments
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Change your last query to:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Index =  | regular expression to catch error max_match=0 | mvexpand error | lookup lookupfile_name error outputs Description, Comments, Threshold  | stats count by Description, Comments, Threshold | eval Comments=case(Comments == "High" AND count &amp;gt; Threshold,  "Critical(Upgraded)", Comments == "Medium" AND count &amp;gt; Threshold, "High(Upgraded)", Comments == "Low" AND count &amp;gt; Threshold, "Medium(Upgraded)", 1==1, component) | search Comments="$Comments$" | stats count by Description
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 30 Mar 2020 17:17:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Evaluate-errors-based-on-thresholds/m-p/461306#M8191</guid>
      <dc:creator>manjunathmeti</dc:creator>
      <dc:date>2020-03-30T17:17:50Z</dc:date>
    </item>
    <item>
      <title>Re: Evaluate errors based on thresholds</title>
      <link>https://community.splunk.com/t5/Alerting/Evaluate-errors-based-on-thresholds/m-p/461307#M8192</link>
      <description>&lt;P&gt;Ah!  Now it makes sense.  Amending my answer.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Mar 2020 20:16:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Evaluate-errors-based-on-thresholds/m-p/461307#M8192</guid>
      <dc:creator>rmmiller</dc:creator>
      <dc:date>2020-03-30T20:16:14Z</dc:date>
    </item>
    <item>
      <title>Re: Evaluate errors based on thresholds</title>
      <link>https://community.splunk.com/t5/Alerting/Evaluate-errors-based-on-thresholds/m-p/461308#M8193</link>
      <description>&lt;P&gt;@prettysunshinez, did this solve your problem?&lt;/P&gt;</description>
      <pubDate>Wed, 01 Apr 2020 21:13:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Evaluate-errors-based-on-thresholds/m-p/461308#M8193</guid>
      <dc:creator>rmmiller</dc:creator>
      <dc:date>2020-04-01T21:13:36Z</dc:date>
    </item>
    <item>
      <title>Re: Evaluate errors based on thresholds</title>
      <link>https://community.splunk.com/t5/Alerting/Evaluate-errors-based-on-thresholds/m-p/461309#M8194</link>
      <description>&lt;P&gt;I have another major requirement to be added on to this.&lt;BR /&gt;
In the lookup file,the fifth column is a time duration,and so my query has to check if the count exceeds the threshold or not fr tht time duration.&lt;/P&gt;

&lt;P&gt;Error1 abc medium 250 30(in mins)&lt;/P&gt;

&lt;P&gt;Something like the above&lt;/P&gt;</description>
      <pubDate>Thu, 02 Apr 2020 10:07:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Evaluate-errors-based-on-thresholds/m-p/461309#M8194</guid>
      <dc:creator>prettysunshinez</dc:creator>
      <dc:date>2020-04-02T10:07:34Z</dc:date>
    </item>
    <item>
      <title>Re: Evaluate errors based on thresholds</title>
      <link>https://community.splunk.com/t5/Alerting/Evaluate-errors-based-on-thresholds/m-p/461310#M8195</link>
      <description>&lt;P&gt;You mean Error1 is a medium as long as there are not more than 250 within a 30 minute time period?&lt;/P&gt;</description>
      <pubDate>Thu, 02 Apr 2020 14:35:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Evaluate-errors-based-on-thresholds/m-p/461310#M8195</guid>
      <dc:creator>rmmiller</dc:creator>
      <dc:date>2020-04-02T14:35:55Z</dc:date>
    </item>
    <item>
      <title>Re: Evaluate errors based on thresholds</title>
      <link>https://community.splunk.com/t5/Alerting/Evaluate-errors-based-on-thresholds/m-p/461311#M8196</link>
      <description>&lt;P&gt;And if that's the case, what is the output of your first and drill down queries supposed to look like?&lt;/P&gt;</description>
      <pubDate>Thu, 02 Apr 2020 14:39:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Evaluate-errors-based-on-thresholds/m-p/461311#M8196</guid>
      <dc:creator>rmmiller</dc:creator>
      <dc:date>2020-04-02T14:39:39Z</dc:date>
    </item>
    <item>
      <title>Re: Evaluate errors based on thresholds</title>
      <link>https://community.splunk.com/t5/Alerting/Evaluate-errors-based-on-thresholds/m-p/461312#M8197</link>
      <description>&lt;P&gt;1.Yes..&lt;/P&gt;

&lt;P&gt;2.if they have not exceeded the threshold they will be in medium and if exceeded high(upgraded)&lt;/P&gt;

&lt;P&gt;And rest are all same&lt;/P&gt;</description>
      <pubDate>Thu, 02 Apr 2020 15:46:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Evaluate-errors-based-on-thresholds/m-p/461312#M8197</guid>
      <dc:creator>prettysunshinez</dc:creator>
      <dc:date>2020-04-02T15:46:08Z</dc:date>
    </item>
  </channel>
</rss>

