Splunk Search

Passing paramaters to subsearch

balcv
Contributor

I have a search that returns two fields, Username and Location, for a specific username.  To extend this search, I would also like to see:

a) any other usernames, in addition to the one searched for, in the same location(s).  So if the initial search returns two different locations, I would like to see the additional users for both locations;

b) if the _time value for the additional usernames are within 15minutes (+ or -) of the initial username.

Current search that returns the data for a specific Username is

 

 

(index="o365" OR index="main") (type="New-Request" OR Operation="*") Username="smith*" Campus="MainSite"
| dedup Username,Location
| fields _time,Username,type,Operation,Location,DateTime,SSID,Campus,src_ip,Client_Mac
| table Username,Location

 

 

 

I'm assuming I need to do a nested search, I'm just not sure how to prepare it and pass the relevant location to return the addition usernames.

Labels (1)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Try using the map command documentation  The examples are close to what you are trying. You should either calculate an earliest and latest time (- and + 15 minutes) in your initial query so they can be passed into map or save _time to a new field to pass in and calculate earliest and latest in the map search

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas     Cisco Live 2026 is almost here, and this ...

What Is the Name of the USB Key Inserted by Bob Smith? (BOTS Hint, Not the Answer)

Hello Splunkers,   So you searched, “what is the name of the usb key inserted by bob smith?”  Not gonna lie… ...

Automating Threat Operations and Threat Hunting with Recorded Future

    Automating Threat Operations and Threat Hunting with Recorded Future June 29, 2026 | Register   Is your ...