Splunk Search

How to join two searches based on two different formatted fields

sangs8788
Communicator

I have an index which contains field - TXN_ID = "24, 25 "
index=index1 TXN_ID ="24,25"

I have another event in different index which has field - ID = 25
index=index2 ID=25

How do i combine both these two queries to get the other details from Index1 ? I know we have to use join. But since the index1 field value contains comma separated value, i am not very sure on how to form the query. Can someone help me on this.

Tags (1)
0 Karma

harishalipaka
Motivator

hi @sangs8788

index=index1 TXN_ID ="24,25" | makemv delim="," TXN_ID |mvexpand TXN_ID|rename TXN_ID  as ID |join ID [search index=index2 ID=25 ]
Thanks
Harish
0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

Try this:

index=index1 TXN_ID ="24,25" | eval ID = split(TXN_ID,",") | mvexpand ID | join ID [  search index=index2 ID=25 ]

Sample:

| makeresults | eval TXN_ID ="24,25" | eval ID = split(TXN_ID,",") | mvexpand ID | join ID [ | makeresults | eval ID = 24 | table _time ID]
0 Karma
Get Updates on the Splunk Community!

See your relevant APM services, dashboards, and alerts in one place with the updated ...

As a Splunk Observability user, you have a lot of data you have to manage, prioritize, and troubleshoot on a ...

Index This | What goes away as soon as you talk about it?

May 2025 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with this month’s ...

What's New in Splunk Observability Cloud and Splunk AppDynamics - May 2025

This month, we’re delivering several new innovations in Splunk Observability Cloud and Splunk AppDynamics ...