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
SplunkTrust
SplunkTrust

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
SplunkTrust
SplunkTrust

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!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...