<?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 for multiple server login search in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Create-alert-for-multiple-server-login-search/m-p/480119#M134569</link>
    <description>&lt;P&gt;Minor correction &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=wineventlog source="WinEventLog:Security" EventID=4624 earliest=-30m latest=now
     |stats dc(host) as hosts values(host) as host_name by Account_Name
     |where hosts&amp;gt;1
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 28 Feb 2020 09:59:52 GMT</pubDate>
    <dc:creator>sumanssah</dc:creator>
    <dc:date>2020-02-28T09:59:52Z</dc:date>
    <item>
      <title>Create alert for multiple server login search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Create-alert-for-multiple-server-login-search/m-p/480116#M134566</link>
      <description>&lt;P&gt;I need an alert that notifies me when the SAME Account_Name logs into 2 specific hosts within the same 30 minute window.  I'd like to see the events grouped by Account_Name.  We auth with AD.  Not sure the best way to do this.  Logically, it works, but I only see events from the bracketed [search].  Any help would be appreciated.  Thank you.&lt;BR /&gt;
Here's what I have so far:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=wineventlog earliest=-30m latest=now source="WinEventLog:Security" (src_ip="10.14.111.60")
| join Account_Name
[ search index=wineventlog earliest=-30m latest=now source="WinEventLog:Security" (src_ip="10.13.111.60")  ]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:22:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Create-alert-for-multiple-server-login-search/m-p/480116#M134566</guid>
      <dc:creator>emasiello</dc:creator>
      <dc:date>2020-09-30T04:22:04Z</dc:date>
    </item>
    <item>
      <title>Re: Create alert for multiple server login search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Create-alert-for-multiple-server-login-search/m-p/480117#M134567</link>
      <description>&lt;P&gt;First build a search which identifies your logon events.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;index=wineventlog source="WinEventLog:Security" EventID=4624 earliest=-30m latest=now&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Then count the number of distinct Account_Names that logged in&lt;BR /&gt;
&lt;CODE&gt;|stats dc(Account_Name)&lt;/CODE&gt;&lt;BR /&gt;
That tells you how many unique users logged in in the last 30 minutes - nice, but not quite what you are after.&lt;/P&gt;

&lt;P&gt;Expand your search to give you how many users logged in to each host&lt;BR /&gt;
&lt;CODE&gt;|stats dc(Account_Name) by host&lt;/CODE&gt;&lt;BR /&gt;
Now you can see how many users logged into each host - better, but still not quite there...&lt;/P&gt;

&lt;P&gt;Lets see how many distinct users logged into distinct hosts&lt;BR /&gt;
&lt;CODE&gt;|stats dc(Account_Name) dc(host) by Account_Name,host&lt;/CODE&gt;&lt;BR /&gt;
Thats looking better, now to tidy it up.. &lt;/P&gt;

&lt;P&gt;Just limit it to users who have logged into &amp;gt;1 host.&lt;BR /&gt;
&lt;CODE&gt;|stats dc(Account_Name) as users dc(host) as hosts by Account_Name,host|where hosts&amp;gt;1|table Account_Name host&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Your final query is then:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=wineventlog source="WinEventLog:Security" EventID=4624 earliest=-30m latest=now
|stats dc(Account_Name) as users dc(host) as hosts by Account_Name,host
|where hosts&amp;gt;1
|table Account_Name host
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:22:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Create-alert-for-multiple-server-login-search/m-p/480117#M134567</guid>
      <dc:creator>nickhills</dc:creator>
      <dc:date>2020-09-30T04:22:13Z</dc:date>
    </item>
    <item>
      <title>Re: Create alert for multiple server login search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Create-alert-for-multiple-server-login-search/m-p/480118#M134568</link>
      <description>&lt;P&gt;Moved to an answer, I think it's very possibly a good answer, so let's give @&lt;A href="mailto:emasiello@fhlb-of.com"&gt;emasiello@fhlb-of.com&lt;/A&gt; a chance to accept it.  &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;If instead we need a bit of back and forth, well, comment-away!&lt;/P&gt;</description>
      <pubDate>Fri, 28 Feb 2020 03:11:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Create-alert-for-multiple-server-login-search/m-p/480118#M134568</guid>
      <dc:creator>Richfez</dc:creator>
      <dc:date>2020-02-28T03:11:13Z</dc:date>
    </item>
    <item>
      <title>Re: Create alert for multiple server login search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Create-alert-for-multiple-server-login-search/m-p/480119#M134569</link>
      <description>&lt;P&gt;Minor correction &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=wineventlog source="WinEventLog:Security" EventID=4624 earliest=-30m latest=now
     |stats dc(host) as hosts values(host) as host_name by Account_Name
     |where hosts&amp;gt;1
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 28 Feb 2020 09:59:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Create-alert-for-multiple-server-login-search/m-p/480119#M134569</guid>
      <dc:creator>sumanssah</dc:creator>
      <dc:date>2020-02-28T09:59:52Z</dc:date>
    </item>
    <item>
      <title>Re: Create alert for multiple server login search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Create-alert-for-multiple-server-login-search/m-p/480120#M134570</link>
      <description>&lt;P&gt;Thanks.  This is mostly what I need.   I'm querying AD for the auth.  So, I need (src_ip=10.13.111.60 OR src_ip=10.14.111.60) in there.   The alert needs to tell me when there's an authentication for both src_ip's.  The query part works.  Now I need to only generate output when both src_ip's are logged.&lt;/P&gt;

&lt;P&gt;It's something like this:&lt;BR /&gt;
index=wineventlog source="WinEventLog:Security" EventCode=4624 (src_ip=10.13.111.60 OR src_ip=10.14.111.60) | stats dc(Account_Name) dc(src_ip) by Account_Name [[[[ where the number in the src_ip column  equals 2 ]]]]  &lt;/P&gt;

&lt;P&gt;I cannot get syntax for this last part.  Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:23:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Create-alert-for-multiple-server-login-search/m-p/480120#M134570</guid>
      <dc:creator>emasiello</dc:creator>
      <dc:date>2020-09-30T04:23:15Z</dc:date>
    </item>
    <item>
      <title>Re: Create alert for multiple server login search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Create-alert-for-multiple-server-login-search/m-p/480121#M134571</link>
      <description>&lt;P&gt;You only need one of either &lt;CODE&gt;dc(Account_Name)&lt;/CODE&gt; or &lt;CODE&gt;by Account_Name&lt;/CODE&gt; to get that stats right, but you'll want the &lt;CODE&gt;by Account_Name&lt;/CODE&gt; because it'll do what you need better.   They you'll just have a &lt;CODE&gt;where&lt;/CODE&gt; (or in this case, &lt;CODE&gt;search&lt;/CODE&gt; would be fine*) after it.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=wineventlog source="WinEventLog:Security" EventCode=4624 (src_ip=10.13.111.60 OR src_ip=10.14.111.60) 
| stats dc(src_ip) AS distinct_sources BY Account_Name 
| where distinct_sources &amp;gt; 1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;That should do it. &lt;/P&gt;

&lt;P&gt;Or change it to a search - &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=wineventlog source="WinEventLog:Security" EventCode=4624 (src_ip=10.13.111.60 OR src_ip=10.14.111.60) 
| stats dc(src_ip) AS distinct_sources BY Account_Name 
| search distinct_sources &amp;gt; 1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;UL&gt;
&lt;LI&gt;The main difference between &lt;CODE&gt;search&lt;/CODE&gt; and &lt;CODE&gt;where&lt;/CODE&gt; is that &lt;CODE&gt;where&lt;/CODE&gt; lets you compare two fields, like &lt;CODE&gt;where distinct_sources &amp;gt; myOtherfield&lt;/CODE&gt;, and search only searches one field against a string/constant/whatever.  In this case, you are just searching for greater than some number, so...&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;Which brings up the time you'd need where - if you were to set a threshold (which isn't really that useful in this simple case, but can be useful in more complex ones), you could do something like &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=wineventlog source="WinEventLog:Security" EventCode=4624 (src_ip=10.13.111.60 OR src_ip=10.14.111.60) 
| stats dc(src_ip) AS distinct_sources BY Account_Name 
| eval threshold_of_badness = 2
| where distinct_sources &amp;gt;= threshold_of_badness
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 02 Mar 2020 15:45:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Create-alert-for-multiple-server-login-search/m-p/480121#M134571</guid>
      <dc:creator>Richfez</dc:creator>
      <dc:date>2020-03-02T15:45:03Z</dc:date>
    </item>
  </channel>
</rss>

