Splunk Search

How to compare values in fields from 2 indexes?

Luninho
Explorer

I have 2 indexes: index1 and index2. I need to compare values in both indexes and show only differences in fields. In both indexes always exist the same field - time, so I need match by this field.

For example:

Index1
Time - 26.11.20
Field1 - xxxx
Field2 - xxxx

and

Index2
Time - 26.11.20
Field1 - xxxx
Field2 - xxxy

I want to get a table:

Field2 - xxxx
Field2 - xxxy

Labels (1)
Tags (1)
0 Karma

to4kawa
Ultra Champion
| makeresults
| eval Time="26.11.20",Field1="xxxx",Field2="xxxx"
| appendpipe [eval Time="26.11.20",Field1="xxxx",Field2="xxxy"]
| rename COMMENT as "From here, the logic"
| untable Time Field Value
| stats values(Value) as Value by Time Field
| where mvcount(Value)=2
| xyseries Time Field Value
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...