<?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 create alert when http error code from a given IP reaches a threshold in Alerting</title>
    <link>https://community.splunk.com/t5/Alerting/create-alert-when-http-error-code-from-a-given-IP-reaches-a/m-p/57572#M794</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I'd like to create alert for the following scenario:&lt;/P&gt;

&lt;P&gt;in http access log, we have different return codes 2xx,3xx,4xx,5xx, etc. I'd like to get an alert when within a 10 minutes windows, the returned code 4xx for an source IP is higher than 10%.  The alert will include all the source IPs that meet the percentage requirement as well as the percentage of 4xx.  The alert would show sth. like the following:&lt;/P&gt;

&lt;P&gt;source ip           percentage of 4xx&lt;BR /&gt;
a.b.c.d                         20%&lt;BR /&gt;
x.x.x.x                         13%  &lt;/P&gt;

&lt;P&gt;One difficulty here is that new IPs keep showing up. Would really appreciate if anyone can help.&lt;/P&gt;

&lt;P&gt;Thanks. &lt;/P&gt;</description>
    <pubDate>Fri, 07 Jun 2013 06:02:11 GMT</pubDate>
    <dc:creator>cscchen</dc:creator>
    <dc:date>2013-06-07T06:02:11Z</dc:date>
    <item>
      <title>create alert when http error code from a given IP reaches a threshold</title>
      <link>https://community.splunk.com/t5/Alerting/create-alert-when-http-error-code-from-a-given-IP-reaches-a/m-p/57572#M794</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I'd like to create alert for the following scenario:&lt;/P&gt;

&lt;P&gt;in http access log, we have different return codes 2xx,3xx,4xx,5xx, etc. I'd like to get an alert when within a 10 minutes windows, the returned code 4xx for an source IP is higher than 10%.  The alert will include all the source IPs that meet the percentage requirement as well as the percentage of 4xx.  The alert would show sth. like the following:&lt;/P&gt;

&lt;P&gt;source ip           percentage of 4xx&lt;BR /&gt;
a.b.c.d                         20%&lt;BR /&gt;
x.x.x.x                         13%  &lt;/P&gt;

&lt;P&gt;One difficulty here is that new IPs keep showing up. Would really appreciate if anyone can help.&lt;/P&gt;

&lt;P&gt;Thanks. &lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2013 06:02:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/create-alert-when-http-error-code-from-a-given-IP-reaches-a/m-p/57572#M794</guid>
      <dc:creator>cscchen</dc:creator>
      <dc:date>2013-06-07T06:02:11Z</dc:date>
    </item>
    <item>
      <title>Re: create alert when http error code from a given IP reaches a threshold</title>
      <link>https://community.splunk.com/t5/Alerting/create-alert-when-http-error-code-from-a-given-IP-reaches-a/m-p/57573#M795</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;you could use a search similar to this (the status field contains the http status code an host would contain the ip for your example):&lt;/P&gt;

&lt;P&gt;sourcetype="access_combined" | eval status_category=substr(status,0,1)+"xx" | stats count as total count(eval(status_category="4xx")) as bad_status by host | eval Percentage=100*round(bad_status/total,2) | where Percentage&amp;gt;10&lt;/P&gt;

&lt;P&gt;Schedule the search to run in realtime over a window of 10 minutes and create one alert per result. &lt;/P&gt;

&lt;P&gt;If you need help creating the alert let me know. If you need help with the search -&amp;gt; post some example events and let me know if the source ip &amp;amp; status are extracted as fields (if you do not know what a field is yet I'll explain).&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 14:04:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/create-alert-when-http-error-code-from-a-given-IP-reaches-a/m-p/57573#M795</guid>
      <dc:creator>chris</dc:creator>
      <dc:date>2020-09-28T14:04:27Z</dc:date>
    </item>
  </channel>
</rss>

