Splunk Search

Using the results of one search to perform another

vjzone
Path Finder

I want to list ALL customers who bought a watch and then use their userId to list out all of their purchases(not limited to watches).
I'm trying to solve this using subsearches. But, its not helping. Can anyone suggest a solution?

source="foobar"
[search xxx OR yyy OR zzz source="foobar" mdn
| rex field=_raw "(?[0-9]+)" max_match=0
| dedup MDN
| rename MDN as search]
| rex field=_raw "(?[0-9]+)" max_match=0
| dedup orderid
| stats list(orderId) by MDN

Tags (1)
0 Karma
1 Solution

renjith_nair
Legend

Hi @vjzone,

Try something similar after changing the logic according to your events,

index="your index" source=foobar purchase=* [index="your index" source=foobar purchase=watch |table userid|dedup userid]

Below reference might give you some idea ,

https://docs.splunk.com/Documentation/Splunk/7.1.1/Search/Aboutsubsearches#Example_2:_Using_a_subsea...

---
What goes around comes around. If it helps, hit it with Karma 🙂

View solution in original post

0 Karma

renjith_nair
Legend

Hi @vjzone,

Try something similar after changing the logic according to your events,

index="your index" source=foobar purchase=* [index="your index" source=foobar purchase=watch |table userid|dedup userid]

Below reference might give you some idea ,

https://docs.splunk.com/Documentation/Splunk/7.1.1/Search/Aboutsubsearches#Example_2:_Using_a_subsea...

---
What goes around comes around. If it helps, hit it with Karma 🙂
0 Karma

renjith_nair
Legend

Hi @vjzone, lets know if you still have questions

---
What goes around comes around. If it helps, hit it with Karma 🙂
0 Karma
Get Updates on the Splunk Community!

Observability Unlocked: Kubernetes Monitoring with Splunk Observability Cloud

 Ready to master Kubernetes and cloud monitoring like the pros? Join Splunk’s Growth Engineering team for an ...

Update Your SOAR Apps for Python 3.13: What Community Developers Need to Know

To Community SOAR App Developers - we're reaching out with an important update regarding Python 3.9's ...

October Community Champions: A Shoutout to Our Contributors!

As October comes to a close, we want to take a moment to celebrate the people who make the Splunk Community ...