Splunk Search

Alternative for join.

sandeepmakkena
Contributor

index=core a=BuilderService AND "decision.received" "Overrides" NOT "ItemOverrides=()" NOT commitCode=null
| rename Orderid as data.Orderid
| join data. Orderid
[ search index=transaction "mileStoneId"=SESSION_CREATE
| rename commitCode as CommitCodeAtSessionCreate]
| join data. Orderid
[ search index=transaction "mileStoneId"="ORDER_RELEASE"
| rename commitCode as CommitCodeAtWebOrderRelease]
| table data.Orderid,CommitCodeAtSessionCreate,commitCode,data.webOrderNumber,CommitCodeAtWebOrderRelease
| rename commitCode as OverridenCommitCode

I am trying to print commitCode at different stages of order placement.This works but, I just don't want to use join.
Thanks for your time.

0 Karma

DavidHourani
Super Champion

Hi @sandeepmakkena,

Try something like this :

(index=core a=BuilderService AND "decision.received" "Overrides" NOT "ItemOverrides=()" NOT commitCode=null)
OR
(index=transaction "mileStoneId"=SESSION_CREATE)
OR
(index=transaction "mileStoneId"="ORDER_RELEASE")
|rename data.Orderid as Orderid, data.webOrderNumber as webOrderNumber
|eval CommitCodeAtSessionCreate=if(mileStoneId="SESSION_CREATE",mileStoneId,null())
|eval CommitCodeAtWebOrderRelease=if(mileStoneId="ORDER_RELEASE",mileStoneId,null())
|stats values(CommitCodeAtSessionCreate) as CommitCodeAtSessionCreate values(commitCode) as commitCode values(CommitCodeAtWebOrderRelease) as CommitCodeAtWebOrderRelease values(webOrderNumber) as webOrderNumber by Orderid

Let me know if that helps.

Cheers,
David

0 Karma

sandeepmakkena
Contributor

Thanks for your time Devid, but I want to print commitCodes for orders only that have decision received orders not for all the weborders.

Just to make clear I want to print commitcodes for the orders that, has milestoneID Session_create or Order_release and have a decision received and Overrider before.

0 Karma

DavidHourani
Super Champion

In that case all you need to do is include an extra check to insure that the orderid is in both indices :

 (index=core a=BuilderService AND "decision.received" "Overrides" NOT "ItemOverrides=()" NOT commitCode=null)
 OR
 (index=transaction "mileStoneId"=SESSION_CREATE)
 OR
 (index=transaction "mileStoneId"="ORDER_RELEASE")
 |rename data.Orderid as Orderid, data.webOrderNumber as webOrderNumber
 |eval CommitCodeAtSessionCreate=if(mileStoneId="SESSION_CREATE",mileStoneId,null())
 |eval CommitCodeAtWebOrderRelease=if(mileStoneId="ORDER_RELEASE",mileStoneId,null())
 |stats dc(index) as condition values(CommitCodeAtSessionCreate) as CommitCodeAtSessionCreate values(commitCode) as commitCode values(CommitCodeAtWebOrderRelease) as CommitCodeAtWebOrderRelease values(webOrderNumber) as webOrderNumber by Orderid
|where condition >1
0 Karma
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!

Mile High Learning with Splunk University, Denver, Colorado

If Denver is known for its mile-high elevation, Splunk University is about to raise the bar on technical ...

IT Service Intelligence 5.0 Series: Your Guide to the June Launch

We are excited to announce the June release of Splunk IT Service Intelligence (ITSI) 5.0. This update ...

Agent Mode Engaged! Enchaining Agentic Operations with Splunk AI Assistant 2.0

    Are you ready to transform how your team handles complex data requests? We invite you to our upcoming ...