Dashboards & Visualizations

Splunk nested query

smorla
New Member
index="abc" aws_appcode="123" logGroup="watch" region="us-east-1" (cwmessage.message = "*Notification(REQUESTED)*")
|stats latest(_time) as start_time by cwmessage.transId
|join cwmessage.transId
[search index="abc" aws_appcode="123" logGroup="watch" region="us-east-1" (cwmessage.message = "*Notification(COMPLETED)*")
|stats latest(_time) as cdx_time by cwmessage.transId ]
[search index="abc" aws_appcode="123" logGroup="watch" region="us-east-1" (cwmessage.message = "*Notification(UPDATeD)*")
|stats latest(_time) as upd_time by cwmessage.transId ]
|join cwmessage.transId
|eval cdx=cdx_time-start_time, upd=upd_time-cdx_time
|table cwmessage.transId, cdx,upd



From above query I'm using index query in multiple times, i want to use it as base search and call that in all nested searches for the dashboard. Please help me.
Thanks

Labels (1)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

Are you trying to reduce the number of joins in the query (a good goal) or use this query in multiple dashboard panels (or maybe both)?

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

ITWhisperer
SplunkTrust
SplunkTrust

Try something like this

index="abc" aws_appcode="123" logGroup="watch" region="us-east-1" (cwmessage.message = "*Notification(REQUESTED)*") OR (cwmessage.message = "*Notification(COMPLETED)*") OR (cwmessage.message = "*Notification(UPDATED)*")
| stats latest(eval(if(match('cwmessage.message',".*Notification\(REQUESTED\).*"),_time,null()))) as start_time latest(eval(if(match('cwmessage.message',".*Notification\(COMPLETED\).*"),_time,null()))) as cdx_time latest(eval(if(match('cwmessage.message',".*Notification\(UPDATED\).*"),_time,null()))) as upd_time by cwmessage.transId
| eval cdx=cdx_time-start_time, upd=upd_time-cdx_time
| table cwmessage.transId, cdx,upd
0 Karma

smorla
New Member

Okay will try. Thanks.

0 Karma
Get Updates on the Splunk Community!

Unlock Database Monitoring with Splunk Observability Cloud

  In today’s fast-paced digital landscape, even minor database slowdowns can disrupt user experiences and ...

Purpose in Action: How Splunk Is Helping Power an Inclusive Future for All

At Cisco, purpose isn’t a tagline—it’s a commitment. Cisco’s FY25 Purpose Report outlines how the company is ...

[Upcoming Webinar] Demo Day: Transforming IT Operations with Splunk

Join us for a live Demo Day at the Cisco Store on January 21st 10:00am - 11:00am PST In the fast-paced world ...