<?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 Active Directory: How to trigger an alert if there are 3 failed logins followed by a successful login? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Active-Directory-How-to-trigger-an-alert-if-there-are-3-failed/m-p/244068#M72638</link>
    <description>&lt;P&gt;We are using a basic use case to test two methods to do event correlation in Splunk.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Method 1 Regex:&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(eventtype="Logon_Success" OR eventtype="Failed_Logins")|stats list(eventtype) as list by Account_Name|eval  list = mvjoin(list, " ")|eval alert = if(match(list,"((Failed_Logins.*){3,}?)(Logon_Success\s?)"),"True","False")|search alert="True"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Method 2:&lt;/STRONG&gt;&lt;BR /&gt;
Step 1: Create Active List similar to ArcSight (list that accumulates events)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(eventtype="Failed_Logins")|eval last_seen = now()| inputlookup append=t mylist| table Account_Name, EventCode, eventtype, _time, last_seen| eval now = now()|eval ttl = 3600 * 24| where (now - last_seen) &amp;lt; ttl |table Account_Name, EventCode, eventtype, _time, last_seen, now, ttl| outputlookup mylist.csv
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Step 2: Refer to lookup list to trigger alert&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="WinEventLog:Security" EventCode=4624 OR EventCode=528 OR EventCode=540
|stats count by Account_Name
|eval state="Sucess"
|append [inputlookup mylist.csv|stats count by Account_Name| where count &amp;gt;=3 | eval state="Failed"]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Question: I am having difficulty on this step. How do you trigger an alert with 3 failed logins (this event happens first) followed by a successful login? I find the inputlookup command limiting.&lt;/P&gt;

&lt;P&gt;Any suggestions or other methods is also appreciated.&lt;/P&gt;

&lt;P&gt;Thank you.&lt;/P&gt;</description>
    <pubDate>Wed, 24 Aug 2016 15:55:06 GMT</pubDate>
    <dc:creator>marcasgrain8</dc:creator>
    <dc:date>2016-08-24T15:55:06Z</dc:date>
    <item>
      <title>Active Directory: How to trigger an alert if there are 3 failed logins followed by a successful login?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Active-Directory-How-to-trigger-an-alert-if-there-are-3-failed/m-p/244068#M72638</link>
      <description>&lt;P&gt;We are using a basic use case to test two methods to do event correlation in Splunk.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Method 1 Regex:&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(eventtype="Logon_Success" OR eventtype="Failed_Logins")|stats list(eventtype) as list by Account_Name|eval  list = mvjoin(list, " ")|eval alert = if(match(list,"((Failed_Logins.*){3,}?)(Logon_Success\s?)"),"True","False")|search alert="True"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Method 2:&lt;/STRONG&gt;&lt;BR /&gt;
Step 1: Create Active List similar to ArcSight (list that accumulates events)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(eventtype="Failed_Logins")|eval last_seen = now()| inputlookup append=t mylist| table Account_Name, EventCode, eventtype, _time, last_seen| eval now = now()|eval ttl = 3600 * 24| where (now - last_seen) &amp;lt; ttl |table Account_Name, EventCode, eventtype, _time, last_seen, now, ttl| outputlookup mylist.csv
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Step 2: Refer to lookup list to trigger alert&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="WinEventLog:Security" EventCode=4624 OR EventCode=528 OR EventCode=540
|stats count by Account_Name
|eval state="Sucess"
|append [inputlookup mylist.csv|stats count by Account_Name| where count &amp;gt;=3 | eval state="Failed"]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Question: I am having difficulty on this step. How do you trigger an alert with 3 failed logins (this event happens first) followed by a successful login? I find the inputlookup command limiting.&lt;/P&gt;

&lt;P&gt;Any suggestions or other methods is also appreciated.&lt;/P&gt;

&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Aug 2016 15:55:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Active-Directory-How-to-trigger-an-alert-if-there-are-3-failed/m-p/244068#M72638</guid>
      <dc:creator>marcasgrain8</dc:creator>
      <dc:date>2016-08-24T15:55:06Z</dc:date>
    </item>
    <item>
      <title>Re: Active Directory: How to trigger an alert if there are 3 failed logins followed by a successful login?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Active-Directory-How-to-trigger-an-alert-if-there-are-3-failed/m-p/244069#M72639</link>
      <description>&lt;P&gt;Here is a search I use in my environment to do something similar:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;   index=wineventlog | stats list(Action) as Attempts, count(eval(match(Action,"Failed"))) as Failed, count(eval(match(Action,"Success"))) as Success by Username | where mvcount(Attempts)&amp;gt;=4 AND Success=1 AND Failed&amp;gt;=3
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 24 Aug 2016 20:51:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Active-Directory-How-to-trigger-an-alert-if-there-are-3-failed/m-p/244069#M72639</guid>
      <dc:creator>jpolcari</dc:creator>
      <dc:date>2016-08-24T20:51:58Z</dc:date>
    </item>
  </channel>
</rss>

