Splunk Search

Need help combining the results of two searches into something cohesive

splunkadunk5
Explorer

Hello!

First, I'll admit that I'm relatively new to Splunk, so thank you in advance! I've been tasked to build a search that will detect remote users logging on to local admin accounts. So far I've managed to pull the local admins via WMI using the following search string:

sourcetype="WMI:LocalAdmins" Name="Administrators" | rex field=_raw "PartComp.*?,Name=\"(?<UserName>[^\"]+)\"" | dedup host,Name,UserName | transaction host,Name | table host,UserName

I also know that I can detect external logins using this string (this is specific enough for my purposes):

sourcetype="WinEventLog:Security" EventCode=4624 Logon_Type=3

Now.. I need to find a way to utilize the local admins in the first search, and narrow the second search to only the local admin accounts identified. I'm still progressing in my research into this, but if you fine folks could point me in the right direction I would definitely be thankful.

0 Karma
1 Solution

Raghav2384
Motivator

Try this

sourcetype="WinEventLog:Security" EventCode=4624 Logon_Type=3|join type=outer [search sourcetype="WMI:LocalAdmins" Name="Administrators" | rex field=_raw "PartComp.*?,Name=\"(?[^\"]+)\"" | dedup host,Name,UserName | transaction host,Name | fields UserName]

Hope this helps!
Thanks,
Raghav

View solution in original post

Raghav2384
Motivator

Try this

sourcetype="WinEventLog:Security" EventCode=4624 Logon_Type=3|join type=outer [search sourcetype="WMI:LocalAdmins" Name="Administrators" | rex field=_raw "PartComp.*?,Name=\"(?[^\"]+)\"" | dedup host,Name,UserName | transaction host,Name | fields UserName]

Hope this helps!
Thanks,
Raghav

splunkadunk5
Explorer

This seems to be working! Didn't think the join command could be implemented so simply; I'll have to read up on that one.

Thank you so much Raghav. Have a great day.

Raghav2384
Motivator

Glad i could help!

Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...