Splunk Search

lookup the fields in a different index

goringop
Explorer

I have a splunk query in paloalto data (index=idx_paloalto) something like this:

index=idx_paloalto sourcetype=pan:traffic app:subcategory=encrypted-tunnel OR app:subcategory=gaming OR app:subcategory=proxy OR app:subcategory=remote-access NOT(application=ssl OR app:subcategory=storage-backup OR app:subcategory=email)
| search action=allowed bytes>=10000000
| eval user=mvindex(split(user,"\\"),-1)
| table app:subcategory generated_time user src_ip application src_zone dest_zone action bytes_in bytes_out bytes
| sort 0 -bytes

result:

app:subcategorygenerated_timeusernamesrc_ipapplicationsrc_zonedest_zoneactionbytes_inbytes_outbytes
encrypted-tunnel8/25/2020 11:19user12310.24.144.81sshGDC-ENETENETallowed36499148121671572953817072107
encrypted-tunnel8/25/2020 6:16user54610.21.132.48sshSVS-InSVS-Inallowed259262655871766260134421

 

Then another query in Active Directory data (index=idx_ms_ad) something like this:

index=idx_msad sourcetype=ActiveDirectory
| eval username = sAMAccountName
| dedup username
| table username displayName mail
| sort -username

result:

usernamedisplayNamemail
user123Tommy Leetommy.lee@domain.com
user546Richard Whiterichard.white@domain.com

 

What I need is to lookup the username from  index  ms_ad and get additional details like the displayname and mail to my paloalto query getting a result something like this:

app:subcategorygenerated_timeusernamedisplayNamemailsrc_ipapplicationsrc_zonedest_zoneactionbytes_inbytes_outbytes
encrypted-tunnel8/25/2020 11:19user123Tommy Leetommy.lee@domain.com10.24.144.81sshGDC-ENETENETallowed36499148121671572953817072107
encrypted-tunnel8/25/2020 6:16user546Richard Whiterichard.white@domain.com10.21.132.48sshSVS-InSVS-Inallowed259262655871766260134421
0 Karma

richgalloway
SplunkTrust
SplunkTrust

Have you tried combining the two searches into a single query?

index=idx_paloalto sourcetype=pan:traffic app:subcategory=encrypted-tunnel OR app:subcategory=gaming OR app:subcategory=proxy OR app:subcategory=remote-access NOT(application=ssl OR app:subcategory=storage-backup OR app:subcategory=email)
| search action=allowed bytes>=10000000
| eval username=mvindex(split(user,"\\"),-1)
| fields app:subcategory generated_time username src_ip application src_zone dest_zone action bytes_in bytes_out bytes
| append [ index=idx_msad sourcetype=ActiveDirectory
| eval username = sAMAccountName
| dedup username
| fields username displayName mail ]
| stats values(*) as * by username
| sort - bytes
| table app:subcategory generated_time username displayName mail src_ip application src_zone dest_zone action bytes_in bytes_out bytes
---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI! Discover how Splunk’s agentic AI ...

[Puzzles] Solve, Learn, Repeat: Dereferencing XML to Fixed-length events

This challenge was first posted on Slack #puzzles channelFor a previous puzzle, I needed a set of fixed-length ...

Stay Connected: Your Guide to December Tech Talks, Office Hours, and Webinars!

What are Community Office Hours? Community Office Hours is an interactive 60-minute Zoom series where ...