Reporting

Need help on joining on multiple search

bhaskar5428
Explorer

bhaskar5428_0-1721202171881.pngbhaskar5428_1-1721202206996.png

 

Hi , Please check above two screenshot , i want to join these queries in such way where i will get AppID along with coluns in first search query 

requirement is appid should come against order id from from first screen shot

 

pls suggest . . 

Labels (1)
0 Karma

bhaskar5428
Explorer

If you want i can share raw event for both queries

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Please post the SPL as text rather than as screen shots.

It looks like the first search would become a subsearch within the second search.

---
If this reply helps you, Karma would be appreciated.
0 Karma

bhaskar5428
Explorer

index = app_events_sdda_core_de_prod source="/home/sdda/apps/logs/sep-app/app-json.log" level=TRACE
| fields message
| rex field=message "\"orderId\":\"(?<orderId>[^\"]+)\"},\"error\":\{\"errorCode\":\"(?<errorCode>[^\"]+)\""
| dedup orderId
| table orderId, errorCode

 

---------------------------------------------------------------------------------------------------------------------------------------

index = app_events_sdda_core_de_prod "Process transaction locally" b95d0d10-9709-4299-9d3e-8c65dd5a539d source="/home/sdda/apps/logs/sep-app/app-json.log"
|rex field=message "deliveringApplication=(?<AppID>\w+)"
|dedup AppID
|table AppID

 

Above order id i have added just for showcase purpose
actually i want SPl in such way that order id in my first SPL automatically get checks in 2nd 
and i will get three column.
Inner search kind of thing

 

pls help 

 

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @bhaskar5428 ,

you need a correlation key that cannot be a simple string, in this case you need to extract this field:

in your case, the correlation key should be orderId, so you could run something like this:

index = app_events_sdda_core_de_prod source="/home/sdda/apps/logs/sep-app/app-json.log" level=TRACE
| rex field=message "\"orderId\":\"(?<orderId>[^\"]+)\"},\"error\":\{\"errorCode\":\"(?<errorCode>[^\"]+)\""
| fields orderId errorCode 
| dedup orderId
| table orderId, errorCode
| append [
index = app_events_sdda_core_de_prod "Process transaction locally" b95d0d10-9709-4299-9d3e-8c65dd5a539d source="/home/sdda/apps/logs/sep-app/app-json.log"
| rex field=message "deliveringApplication=(?<AppID>\w+)"
| rex "(?<orderId>\w{8}-\w{4}-\w{4}-\w{4}-\w{12})"
| dedup AppID
| table AppID orderId ]
| stats 
     values(errorCode) AS errorCode 
     values(AppID) AS AppID 
     BY orderId

This solution has only one limit: you must be sure that the second search will have less than 50,000 results, otherwise, you need a different solution

Ciao.

Giuseppe

Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

May 2026 Splunk Expert Sessions: Security & Observability

Level Up Your Operations: May 2026 Splunk Expert Sessions Whether you are refining your security posture or ...

Network to App: Observability Unlocked [May & June Series]

In today’s digital landscape, your environment is no longer confined to the data center. It spans complex ...

SPL2 Deep Dives, AppDynamics Integrations, SAML Made Simple and Much More on Splunk ...

Splunk Lantern is Splunk’s customer success center that provides practical guidance from Splunk experts on key ...