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!

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

Splunk Enterprise Security 8.x: The Essential Upgrade for Threat Detection, ...

Watch On Demand the Tech Talk on November 6 at 11AM PT, and empower your SOC to reach new heights! Duration: ...

Splunk Observability as Code: From Zero to Dashboard

For the details on what Self-Service Observability and Observability as Code is, we have some awesome content ...