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!

Deep Dive: Accelerate threat investigation with Splunk’s AI Assistant in Security

AI is one of the biggest topics in the market today, and for security teams, its value goes far beyond the ...

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Detection Engineering Office Hours: Real-World Troubleshooting & Q&A

[REGISTER HERE] This thread is for the Community Office Hours session on Detection Engineering Office Hours: ...