<?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: Create alert that checks every 30 mins if the attempt to FTP file to another host fails 3 times in a row? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Create-alert-that-checks-every-30-mins-if-the-attempt-to-FTP/m-p/292897#M88422</link>
    <description>&lt;P&gt;Omeri,&lt;/P&gt;

&lt;P&gt;You nailed it! My customer is very happy and so am I.&lt;/P&gt;

&lt;P&gt;Your response time and suggestion was easy to implement and dead on. And the extra edit add at the bottom even made it better.  Report looks sweet.&lt;/P&gt;

&lt;P&gt;I really appreciate this help. &lt;BR /&gt;
Thanks much,&lt;BR /&gt;
Damon&lt;/P&gt;</description>
    <pubDate>Thu, 29 Mar 2018 18:26:21 GMT</pubDate>
    <dc:creator>damonmanni</dc:creator>
    <dc:date>2018-03-29T18:26:21Z</dc:date>
    <item>
      <title>Create alert that checks every 30 mins if the attempt to FTP file to another host fails 3 times in a row?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Create-alert-that-checks-every-30-mins-if-the-attempt-to-FTP/m-p/292895#M88420</link>
      <description>&lt;P&gt;Goal:&lt;BR /&gt;
If "[FATAL]" FTP message to same destination host "host-xyz" is found 3 times within 1 minute, then trigger alert to send email to admin.&lt;/P&gt;

&lt;P&gt;Alert results:&lt;BR /&gt;
Should be grouped by time showing which hostnames failed within a 1 minute period.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Time               host 
TIMESTAMP          host-xyz                    
TIMESTAMP          host-albert
                   host-jimbob
TIMESTAMP          host-abc
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;My problem:&lt;BR /&gt;
1) I am getting most of what i need from my query but I don't know how to organize the results to display as i describe above.&lt;BR /&gt;
2) I don't think I am counting properly of 3 events within 1 min, as my current alert results show below.&lt;/P&gt;

&lt;P&gt;Sample Log data events:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2018-Mar-19 20:18:26 [FATAL] ./ftphub_push.sh could not FTP file to host-xyz  1/1 attempt
2018-Mar-19 20:18:26 [FATAL] ./ftphub_push.sh could not FTP file to host-jojo 1/1 attempt
2018-Mar-19 20:18:26 [FATAL] ./ftphub_push.sh could not FTP file to host-xyz  1/1 attempt
2018-Mar-19 20:18:26 [FATAL] ./ftphub_push.sh could not FTP file to host-jojo 1/1 attempt
2018-Mar-19 20:17:56 [FATAL] ./ftphub_push.sh could not FTP file to host-xyz  1/1 attempt
...etc...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Field extract created:&lt;BR /&gt;
I Created field called: 'failed_host' to be the hostname name found on an event  (ex host-xyz)&lt;/P&gt;

&lt;P&gt;Current query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=milo sourcetype=rto  FATAL earliest=-30m@d latest=now | bucket _time span=1m | stats count by failed_host _time | eval occurred=if(count!=3,"FTP failed", null()) | where isnotnull(occurred) | table occurred failed_host _time count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Current alert results:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;occurred      failed_host  _time                count
1 FTP failed  abc837       2018-03-12 08:03:00  2
2 FTP failed  abc837       2018-03-12 08:04:00  2
3 FTP failed  abc840       2018-03-19 17:17:00  2
4 FTP failed  abc840       2018-03-19 17:18:00  2
5 FTP failed  abc841       2018-03-19 17:17:00  2
6 FTP failed  abc841       2018-03-19 17:18:00  2
7 FTP failed  abc842       2018-03-12 08:03:00  2
8 FTP failed  abc842       2018-03-12 08:04:00  2 
9 FTP failed  abc844       2018-03-12 08:03:00  4
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 27 Mar 2018 01:43:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Create-alert-that-checks-every-30-mins-if-the-attempt-to-FTP/m-p/292895#M88420</guid>
      <dc:creator>damonmanni</dc:creator>
      <dc:date>2018-03-27T01:43:54Z</dc:date>
    </item>
    <item>
      <title>Re: Create alert that checks every 30 mins if the attempt to FTP file to another host fails 3 times in a row?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Create-alert-that-checks-every-30-mins-if-the-attempt-to-FTP/m-p/292896#M88421</link>
      <description>&lt;P&gt;I would recommend you to use the &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Transaction"&gt;&lt;CODE&gt;transaction&lt;/CODE&gt;&lt;/A&gt; command, as it seems to do exactly what you need.&lt;BR /&gt;
So I would change this query:&lt;BR /&gt;
&lt;CODE&gt;index=milo sourcetype=rto  FATAL earliest=-30m@d latest=now | bucket _time span=1m | stats count by failed_host _time | eval occurred=if(count!=3,"FTP failed", null()) | where isnotnull(occurred) | table occurred failed_host _time count&lt;/CODE&gt;&lt;BR /&gt;
 to something more like: &lt;BR /&gt;
&lt;CODE&gt;index=milo sourcetype=rto FATAL earliest=-30m@m &lt;BR /&gt;
| transaction failed_host maxspan=1m &lt;BR /&gt;
| search eventcount &amp;gt;= 3 &lt;BR /&gt;
| table failed_host _time eventcount&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;And now splunk will look for transaction of the same failing host within 1 minute (=maxspan), and connect them to one event, which includes the &lt;CODE&gt;eventcount&lt;/CODE&gt; field that counts the number of events in the transaction. You may also find the field &lt;CODE&gt;duration&lt;/CODE&gt; interesting (I excluded it in the query), since it tells you exactly what was the duration of the transaction.&lt;/P&gt;

&lt;P&gt;I hope it helps you!&lt;BR /&gt;
Omer&lt;/P&gt;

&lt;P&gt;edit:&lt;BR /&gt;
To organize the results as groups of time I would add this to the end of my query:&lt;BR /&gt;
&lt;CODE&gt;| bin _time span=1m | stats list(*) as * by _time&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Mar 2018 06:55:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Create-alert-that-checks-every-30-mins-if-the-attempt-to-FTP/m-p/292896#M88421</guid>
      <dc:creator>omerl</dc:creator>
      <dc:date>2018-03-28T06:55:20Z</dc:date>
    </item>
    <item>
      <title>Re: Create alert that checks every 30 mins if the attempt to FTP file to another host fails 3 times in a row?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Create-alert-that-checks-every-30-mins-if-the-attempt-to-FTP/m-p/292897#M88422</link>
      <description>&lt;P&gt;Omeri,&lt;/P&gt;

&lt;P&gt;You nailed it! My customer is very happy and so am I.&lt;/P&gt;

&lt;P&gt;Your response time and suggestion was easy to implement and dead on. And the extra edit add at the bottom even made it better.  Report looks sweet.&lt;/P&gt;

&lt;P&gt;I really appreciate this help. &lt;BR /&gt;
Thanks much,&lt;BR /&gt;
Damon&lt;/P&gt;</description>
      <pubDate>Thu, 29 Mar 2018 18:26:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Create-alert-that-checks-every-30-mins-if-the-attempt-to-FTP/m-p/292897#M88422</guid>
      <dc:creator>damonmanni</dc:creator>
      <dc:date>2018-03-29T18:26:21Z</dc:date>
    </item>
  </channel>
</rss>

