Splunk Search

Common Field in Two Different Indexes

ryanprayacn
Explorer

I have two indexes that I can successfully join via stats. However, both indexes have a common field named "STATUS". I want to be able to separate the STATUS field into STATUS1 and STATUS2 before the join - so I can see both. I have left out STATUS below but showing successful join SPL below:

index=customertest OR index=valuetest | stats values(Spend) as spend values(Order) as order by Customer | fillnull value=NULL | mvexpand spend | sort Customer

Any recommendations?

0 Karma
1 Solution

DalJeanis
Legend

Try this...

index=customertest OR index=valuetest 
| eval Status1=case(index="customertest", Status)
| eval Status2=case(index="valuetest", Status)
| stats values(Spend) as spend values(Order) as order values(Status*) as Status* by Customer 
| fillnull value=NULL 
| mvexpand spend 
| sort Customer

View solution in original post

DalJeanis
Legend

Try this...

index=customertest OR index=valuetest 
| eval Status1=case(index="customertest", Status)
| eval Status2=case(index="valuetest", Status)
| stats values(Spend) as spend values(Order) as order values(Status*) as Status* by Customer 
| fillnull value=NULL 
| mvexpand spend 
| sort Customer

ryanprayacn
Explorer

Thanks this worked!

Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...