Splunk Search

Splunk search join

Ponczi1
Explorer

Hello,

I am trying to join two searches so i could get number of declined transactions in time. First i look for inbound messages to get an IDs (it's in txRef tag) of special kinds transactions and then I am looking for outbound messages of all declined transaction to join them together based on the IDs

The search I am using looks like this but it is not working correctly.

index=Auth AuthorizeTransaction Inbound Message "<alias" NOT "<ticket" 
| regex "<txRef>(?<TXREF>\d+)<" 
| eval txRefs = TXREF
| join type=inner txRefs [search index=Auth Outbound Message "declined" | regex "<txRef>(?<TXREF>\d+)</txRef>" | eval txRefs=TXREF]
| timechart span=1h count as "Declined transactions"

EDIT

I have found what i was doing wrong. Apprently i was using Regex instead of Rex so i did not really extract the fields 🙂

0 Karma
1 Solution

mayurr98
Super Champion

Try this:

index=Auth AuthorizeTransaction Inbound Message "<alias" NOT "<ticket" 
 | rex field=_raw "\<txRef\>(?<TXREF>\d+)\<\/txRef\>" 
 | eval txRefs = TXREF
 | join type=inner txRefs [search index=Auth Outbound Message "declined" | rex field=_raw "\<txRef\>(?<TXREF>\d+)\<\/txRef\>" | eval txRefs=TXREF]
 | timechart span=1h count as "Declined transactions"

Let me know if this helps!

View solution in original post

mayurr98
Super Champion

Try this:

index=Auth AuthorizeTransaction Inbound Message "<alias" NOT "<ticket" 
 | rex field=_raw "\<txRef\>(?<TXREF>\d+)\<\/txRef\>" 
 | eval txRefs = TXREF
 | join type=inner txRefs [search index=Auth Outbound Message "declined" | rex field=_raw "\<txRef\>(?<TXREF>\d+)\<\/txRef\>" | eval txRefs=TXREF]
 | timechart span=1h count as "Declined transactions"

Let me know if this helps!

Ponczi1
Explorer

Yeah i figured that "rex" was the problem. But thanks a lot anyway!

0 Karma

nickhills
Ultra Champion

That's good news. Ideally you should post an answer and accept it yourself, so that other people can see that you resolved it, and how. You can also upvote any answer or comments who helped you!

If my comment helps, please give it a thumbs up!
0 Karma

mayurr98
Super Champion

will you please enter your code in 101010 written below text box as there are some escape characters in your query

0 Karma

Ponczi1
Explorer

Sure, sorry

0 Karma
Get Updates on the Splunk Community!

Detecting Remote Code Executions With the Splunk Threat Research Team

REGISTER NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If ...

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...