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!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...