<?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: Custom Condition Search for Alert for HTTP status code report in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Custom-Condition-Search-for-Alert-for-HTTP-status-code-report/m-p/62080#M15335</link>
    <description>&lt;P&gt;Hi David,&lt;/P&gt;

&lt;P&gt;You can use this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="C:\logs\path\*.log" http_status_code=400|  where count &amp;gt; 0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I presume count is a field. A real-time alert or a scheduled alert will do the job.&lt;/P&gt;

&lt;P&gt;Or you have to do the below.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="C:\logs\path\*.log" http_status_code=400|  Stats Count(http_status_code) as Error_Count|where Error_Count &amp;gt; 0
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 12 Sep 2013 17:49:40 GMT</pubDate>
    <dc:creator>linu1988</dc:creator>
    <dc:date>2013-09-12T17:49:40Z</dc:date>
    <item>
      <title>Custom Condition Search for Alert for HTTP status code report</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Custom-Condition-Search-for-Alert-for-HTTP-status-code-report/m-p/62079#M15334</link>
      <description>&lt;P&gt;I have the following search in an alert that triggers every 15 minutes:&lt;/P&gt;

&lt;P&gt;source="C:\logs\path\*.log" | chart count over http_status_code&lt;/P&gt;

&lt;P&gt;http_status_code is a custom field.  The search works well, and gives the nicely formatted output below via html-formatted email:&lt;/P&gt;

&lt;P&gt;http_status_code    count&lt;BR /&gt;
200                  432&lt;BR /&gt;
400                        3&lt;BR /&gt;
401                    4&lt;/P&gt;

&lt;P&gt;I don't want to change the output of this report.  It's perfect the way it is.  I only want to set the condition to only send a notification if 400 gives a count of 1 or more.&lt;/P&gt;

&lt;P&gt;I've searched for some time "splunk custom condition" for an answer on this, but the question is usually extremely complicated, and often the answer requires that the output of the report be changed.  I've also searched the documentation.  (So please no links with vague hints, I've seen them all).&lt;/P&gt;

&lt;P&gt;I've tried the following, but the syntax does not appear to be correct.  I think it should be a fairly simple deal, but apparently not.  Help is appreciated.&lt;/P&gt;

&lt;P&gt;http_status_code=400 | search eventcount&amp;gt;=1&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 14:45:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Custom-Condition-Search-for-Alert-for-HTTP-status-code-report/m-p/62079#M15334</guid>
      <dc:creator>DavidGuarneri</dc:creator>
      <dc:date>2020-09-28T14:45:51Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Condition Search for Alert for HTTP status code report</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Custom-Condition-Search-for-Alert-for-HTTP-status-code-report/m-p/62080#M15335</link>
      <description>&lt;P&gt;Hi David,&lt;/P&gt;

&lt;P&gt;You can use this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="C:\logs\path\*.log" http_status_code=400|  where count &amp;gt; 0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I presume count is a field. A real-time alert or a scheduled alert will do the job.&lt;/P&gt;

&lt;P&gt;Or you have to do the below.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="C:\logs\path\*.log" http_status_code=400|  Stats Count(http_status_code) as Error_Count|where Error_Count &amp;gt; 0
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 12 Sep 2013 17:49:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Custom-Condition-Search-for-Alert-for-HTTP-status-code-report/m-p/62080#M15335</guid>
      <dc:creator>linu1988</dc:creator>
      <dc:date>2013-09-12T17:49:40Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Condition Search for Alert for HTTP status code report</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Custom-Condition-Search-for-Alert-for-HTTP-status-code-report/m-p/62081#M15336</link>
      <description>&lt;P&gt;Thanks for the response.  I already had what you show in your first example as a separate alert.  For this report, can I use this search in the custom condition search field?  I don't want to change the format of the report.  Thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Sep 2013 18:16:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Custom-Condition-Search-for-Alert-for-HTTP-status-code-report/m-p/62081#M15336</guid>
      <dc:creator>DavidGuarneri</dc:creator>
      <dc:date>2013-09-12T18:16:15Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Condition Search for Alert for HTTP status code report</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Custom-Condition-Search-for-Alert-for-HTTP-status-code-report/m-p/62082#M15337</link>
      <description>&lt;P&gt;I tried putting that in the custom condition field.  I get the following error: "Encountered the following error while trying to update: In handler 'savedsearch': Cannot parse alert condition. Unknown search command 'source'."&lt;/P&gt;</description>
      <pubDate>Thu, 12 Sep 2013 18:22:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Custom-Condition-Search-for-Alert-for-HTTP-status-code-report/m-p/62082#M15337</guid>
      <dc:creator>DavidGuarneri</dc:creator>
      <dc:date>2013-09-12T18:22:48Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Condition Search for Alert for HTTP status code report</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Custom-Condition-Search-for-Alert-for-HTTP-status-code-report/m-p/62083#M15338</link>
      <description>&lt;P&gt;Define your base search just as you have:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;source="C:\logs\path*.log" | chart count over http_status_code&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Create an Advanced Conditional Alert to "Trigger if" field value of "Custom condition is met" and enter the follow for the condition text:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;search http_status_code=401 | search count &amp;gt;= 1&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;I think that should work, but you might have to tweak it a bit.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 14:45:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Custom-Condition-Search-for-Alert-for-HTTP-status-code-report/m-p/62083#M15338</guid>
      <dc:creator>zeroactive</dc:creator>
      <dc:date>2020-09-28T14:45:57Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Condition Search for Alert for HTTP status code report</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Custom-Condition-Search-for-Alert-for-HTTP-status-code-report/m-p/62084#M15339</link>
      <description>&lt;P&gt;That looks closer to what I'm trying to do.  I will try it, thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 12 Sep 2013 19:12:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Custom-Condition-Search-for-Alert-for-HTTP-status-code-report/m-p/62084#M15339</guid>
      <dc:creator>DavidGuarneri</dc:creator>
      <dc:date>2013-09-12T19:12:06Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Condition Search for Alert for HTTP status code report</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Custom-Condition-Search-for-Alert-for-HTTP-status-code-report/m-p/62085#M15340</link>
      <description>&lt;P&gt;Why do you need a custom condition?&lt;/P&gt;

&lt;P&gt;111011source="C:\logs\path*.log" http_status_code=400|  Stats Count(Http_status_code) as Error_Count|where Error_Count &amp;gt; 0|Table Http_status_code,Error_Count&lt;/P&gt;

&lt;P&gt;will give you the alert. The above is the original search. Then you can go results &amp;gt; 0.&lt;/P&gt;

&lt;P&gt;And if you really want to give the custom condition you can give  count &amp;gt;= 1&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 14:46:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Custom-Condition-Search-for-Alert-for-HTTP-status-code-report/m-p/62085#M15340</guid>
      <dc:creator>linu1988</dc:creator>
      <dc:date>2020-09-28T14:46:00Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Condition Search for Alert for HTTP status code report</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Custom-Condition-Search-for-Alert-for-HTTP-status-code-report/m-p/62086#M15341</link>
      <description>&lt;P&gt;The above didn't give any results. It gives results only if I type up to "as Error_Count"; however, it only shows the count of 400 errors.&lt;/P&gt;

&lt;P&gt;I need a custom condition because the chart gives a larger data set than the condition that should fire the alert.&lt;/P&gt;

&lt;P&gt;The requirements are to fire one simple alert the minute a 400 error appears for a certain application. After that, a quarter hour report of ALL http status codes broken down by application should fire. I've made both reports successfully, I just need the quarter hour report to fire only when that one application gets a 400 error.&lt;/P&gt;</description>
      <pubDate>Sat, 14 Sep 2013 13:52:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Custom-Condition-Search-for-Alert-for-HTTP-status-code-report/m-p/62086#M15341</guid>
      <dc:creator>DavidGuarneri</dc:creator>
      <dc:date>2013-09-14T13:52:49Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Condition Search for Alert for HTTP status code report</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Custom-Condition-Search-for-Alert-for-HTTP-status-code-report/m-p/62087#M15342</link>
      <description>&lt;P&gt;Unfortunately, the alert of all status codes did not fire after a test log entry was created &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; .  A simpler alert that only reports the count of 400 errors did fire, however.  By the way, the 401 is a typo on my part, which I corrected.  Should be 400.&lt;/P&gt;</description>
      <pubDate>Sat, 14 Sep 2013 14:06:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Custom-Condition-Search-for-Alert-for-HTTP-status-code-report/m-p/62087#M15342</guid>
      <dc:creator>DavidGuarneri</dc:creator>
      <dc:date>2013-09-14T14:06:30Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Condition Search for Alert for HTTP status code report</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Custom-Condition-Search-for-Alert-for-HTTP-status-code-report/m-p/62088#M15343</link>
      <description>&lt;P&gt;I've already created the simple 400 error real time alert.  That one works.  As far as the quarter hour report, I've thought of some workarounds, including having the first alert trigger the second one by using a script that changes a file with a flag.  This seems very roundabout, however.  There has to be a way to get the quarter hour report to fire only when the required conditions exist.&lt;/P&gt;</description>
      <pubDate>Sat, 14 Sep 2013 14:10:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Custom-Condition-Search-for-Alert-for-HTTP-status-code-report/m-p/62088#M15343</guid>
      <dc:creator>DavidGuarneri</dc:creator>
      <dc:date>2013-09-14T14:10:43Z</dc:date>
    </item>
  </channel>
</rss>

