Alerting

Creating Indirect / Cascading Search

dscoland
Path Finder

Hi Splunk Community,

I have, I would hope to be, a simple question.

Our company has always monitored domain account lockouts, but recently we wanted to take it a bit further, and monitor IIS logs for potential lockouts attempted to authenticate against our Exchange CAS servers.

Therefore, our main real-time search script is as such:

index!=_audit EventCode=4740 | table _time, EventCodeDescription, Account_Name, Security_ID, Account_Domain, Caller_Computer_Name, | eval _time=strftime(_time, "%H:%M:%S %m-%d-%y") | fields - _raw | rename _time AS When?, Message AS Who?_Where?

I had an idea that, instead of going through the hassle of associating fields between WinEventLog:Security and iis to figure out why someone would get locked out on our CAS server, it would be more efficient to generate a report of the past 10minutes (give or take 3minutes haven't decided on that), for sc_win32_status=1326 (bad username or password from iis).

Script below:

sourcetype="iis" sc_win32_status=1326 | eval username=lower(cs_username) | fillnull | stats count by username, cs_uri_stem, cs_User_Agent | where count>1 AND count<6 | sort by count desc

My goal would be to generate this IIS report when the Caller_Computer_Name is equal to the name of one of our CAS servers when the EventCode=4740 alert is thrown.

Is there a way to achieve this?

Thank you in advance,
Daniel

Tags (3)
0 Karma
1 Solution

somesoni2
Revered Legend

You can look at the 'map' command using which you can run a search based on the search result of another search.
http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Map

Its should be basically something like this

index!=_audit EventCode=4740 Caller_Computer_Name="YourCASServerName"| stats count | where count > 0 | map [search sourcetype="iis" sc_win32_status=1326 | eval username=lower(cs_username) | fillnull | stats count by username, cs_uri_stem, cs_User_Agent | where count>1 AND count<6 | sort by count desc]

View solution in original post

somesoni2
Revered Legend

You can look at the 'map' command using which you can run a search based on the search result of another search.
http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Map

Its should be basically something like this

index!=_audit EventCode=4740 Caller_Computer_Name="YourCASServerName"| stats count | where count > 0 | map [search sourcetype="iis" sc_win32_status=1326 | eval username=lower(cs_username) | fillnull | stats count by username, cs_uri_stem, cs_User_Agent | where count>1 AND count<6 | sort by count desc]

dscoland
Path Finder

It looks like this can't be run as a real-time alert because it will alert every time that there is a match in the subsearch. Is that a bug?

0 Karma

somesoni2
Revered Legend

Its basically for each search result in base search, you can run the subsearch specified in map command (that's why I used stats to limit base search results to 1). You can't map multiple searches directly but there are workarounds.

0 Karma

dscoland
Path Finder

Wow, dude. I didn't know that the map command was there. Does that mean you can ma multiple searchs, or just one?

0 Karma

dscoland
Path Finder

There will be multiple CAS servers, but all of them will have a static name.

0 Karma

somesoni2
Revered Legend

Name of CAS servers will be a static value?

0 Karma

dscoland
Path Finder

Is this possible with using the Python SDK?

0 Karma
Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...