Splunk Search

Comparing 2 groups of data

ckutach
Engager

I have 2 groups of data:

messageId1: ['A', 'B', 'C']

messageId2: ['A', 'E', 'F', 'G', 'T', 'Z']

 

How do I return the values that are ONLY present in messageId1 and not in messageId2?

So the result for this would be: 'B' and 'C'

Labels (1)
0 Karma

yuanliu
SplunkTrust
SplunkTrust

Or you can use mvexpand

| mvexpand messageId1
| where messageId1 != messageId2
| stats values(messageId1) as unique

 

Tags (2)
0 Karma

bowesmana
SplunkTrust
SplunkTrust

Use mvmap 

| makeresults
| eval messageId1=split("A,B,C", ",")
| eval messageId2=split("A,E,F,G,T,Z", ",")
| eval only_in_id1=mvmap(messageId1, if(isnull(mvfind(messageId2, messageId1)), messageId1, null()))

mvmap expectes 2 MV fields, so depending on what your actual data looks like, tweak accordingly

0 Karma
Get Updates on the Splunk Community!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...