Splunk Search

Pass parent search field value to a subsearch

Dakxh
Explorer

Hi,

I want to know if there is a way to pass parent search field value as source/input for sub-search for a different sourcetype and then stats its field.

e.g) we have an index=risk and the field value extracted from there is Image_Path=C:\windows\hosts.exe and one more index=endpoint which shares common field Image_Path and another field MD5 with different time period.

So i need to extract Image_Path value from the index=risk and then it needs to chained to sub-search with index=endpoint + extracted field value | then it needs to be stats Values(Image_Path) by MD5.

Can this be done ?

0 Karma
1 Solution

tiagofbmm
Influencer

Yes you can do that, using the return command like this:

index=endpoint [
search index=risk Image_Path=C:\windows\hosts.exe
| dedup Image_Path
| return Image_Path]
| stats values(Image_Path) by MD5

Let me know if it works

View solution in original post

tiagofbmm
Influencer

Yes you can do that, using the return command like this:

index=endpoint [
search index=risk Image_Path=C:\windows\hosts.exe
| dedup Image_Path
| return Image_Path]
| stats values(Image_Path) by MD5

Let me know if it works

Dakxh
Explorer

Thank you !! i removed "| return Image_Path" - now i got what i need !!!

0 Karma

tiagofbmm
Influencer

Great! Please accept the answer for future references to the same issue

0 Karma

Dakxh
Explorer

Thanks a lot,

index=risk Image_Path=C:\windows\hosts.exe
| dedup Image_Path
| return Image_Path

"| return Image_path " creating new field "search" with value Image_Path="C:\windows\hosts.exe" but we don't have field search in index=endpoint ? here field name is Image_Path and value is C:\windows\hosts.exe alone any help on this.

0 Karma
Get Updates on the Splunk Community!

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

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...