Getting Data In

How to edit my eventstats search to keep only non-unique events?

rlough
Path Finder

Hey there,

I currently have a query that compares a field to two sources. What I want is to be able to only keep fields with the same value across the events.

Here's what I have:

index=* source=src1.log OR source=src2.log | eventstats dc(source) as source_count by FIELD_NAME | where source_count = 1

The above works, but keeps the unique FIELD_NAME values. Is there a way to do the opposite?

Ex:
src1.log
FIELD_NAME = name1
FIELD_NAME = name2

src2.log
FIELD_NAME = name3
FIELD_NAME = name2

RESULT EVENTS
FIELD_NAME = name2

Thank you in advance!

Tags (2)
0 Karma
1 Solution

martin_mueller
SplunkTrust
SplunkTrust

Replace the 1 with a 2 to get FIELD_NAME values that have two distinct source values, ie exist in both sources.

View solution in original post

martin_mueller
SplunkTrust
SplunkTrust

Replace the 1 with a 2 to get FIELD_NAME values that have two distinct source values, ie exist in both sources.

Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

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