Splunk Search

return search with common fields

simonattardGO
Path Finder

I need to run two sub searches. Each of these sub-searches will return a set of fields, one of them is called transactionNumber.
Then I want to the search to return only those results from the two sub-searches which have an equal transactionNumber.

How can I do this?

Tags (3)
0 Karma
1 Solution

Ayn
Legend

Use set (http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Set):

| set intersect [search search1 | fields transactionNumber | fields - _*] [search search2 | fields transactionNumber | fields - _*]

If you want not just the transactionNumbers but also the actual events, you could feed this into a subsearch:

(search1) OR (search2) [| set intersect [search search1 | fields transactionNumber | fields - _*] [search search2 | fields transactionNumber | fields - _*] | fields transactionNumber ]

View solution in original post

Ayn
Legend

Use set (http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Set):

| set intersect [search search1 | fields transactionNumber | fields - _*] [search search2 | fields transactionNumber | fields - _*]

If you want not just the transactionNumbers but also the actual events, you could feed this into a subsearch:

(search1) OR (search2) [| set intersect [search search1 | fields transactionNumber | fields - _*] [search search2 | fields transactionNumber | fields - _*] | fields transactionNumber ]
Get Updates on the Splunk Community!

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...

Index This | Forward, I’m heavy; backward, I’m not. What am I?

April 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...