Building for the Splunk Platform

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

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

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!

Streamline Data Ingestion With Deployment Server Essentials

REGISTER NOW!Every day the list of sources Admins are responsible for gets bigger and bigger, often making the ...

Remediate Threats Faster and Simplify Investigations With Splunk Enterprise Security ...

REGISTER NOW!Join us for a Tech Talk around our latest release of Splunk Enterprise Security 7.2! We’ll walk ...

Introduction to Splunk AI

WATCH NOWHow are you using AI in Splunk? Whether you see AI as a threat or opportunity, AI is here to stay. ...