Splunk Dev

How to Compare 2 fields from 2 sourcetypes and remove events that are the same and only in the second sourcetype

tnoelOTS
Explorer

I have 2 Sourcetypes A and B with 2 important Fields SSN and Number. I want to compare all of the SSN and number's from Sourcetype A to Sourcetype B I then return Results that only show up in Sourcetype B

Sourcetype A
SSN number

1111 12345 (drop this because it matches B)
2222 12345 (drop this because it is sourcetype A even though it doesn't match)

Sourcetype B
SSN number

1111 12345 (drop this because it matches A)
2222 11111 (keep this because it doesn't match anything in A and it is Sourcetype B)

I am really stuck on this one not even sure where to start.

Tags (1)
0 Karma
1 Solution

somesoni2
Revered Legend

Try like this

sourcetype=SourcetypeA OR sourcetype=sourcetypeB
| stats values(sourcetype) as sourcetypes by SSN number
| where mvcount(sourcetypes)=1 AND sourcetype="sourcetypeB"

View solution in original post

somesoni2
Revered Legend

Try like this

sourcetype=SourcetypeA OR sourcetype=sourcetypeB
| stats values(sourcetype) as sourcetypes by SSN number
| where mvcount(sourcetypes)=1 AND sourcetype="sourcetypeB"
Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

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

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...