Splunk Search

splunk query help

surekhasplunk
Communicator
index=ABC Check!=D 
| stats count by Device Check

I am using this query and getting Device and Related Checks reported by the device.

Now i have a scenario where i need to show only those devices where the Check!=D
And i have data like below

Device Check
india_1 A
india_1 D
india_2 B
india_3 B
india_3 C
india_4 A
india_4 D

output i want is only below 2 devices where D is not there in the check although we have other names in the Check.
Device count
india_2 1
india_3 2

please help me with the query

Labels (1)
Tags (2)
0 Karma
1 Solution

gcusello
SplunkTrust
SplunkTrust

Hi @surekhasplunk,
you cannot filter events in the main search because, in this way, you cannot identify the Devices to exclude, try something like this:

 index=ABC 
| stats values(Device) AS Device count by Check
| where Check!=D 
| mvexpand Device

You need of mvexpand command because you could have more than one value in Device field.

Ciao.
Giuseppe

View solution in original post

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @surekhasplunk,
you cannot filter events in the main search because, in this way, you cannot identify the Devices to exclude, try something like this:

 index=ABC 
| stats values(Device) AS Device count by Check
| where Check!=D 
| mvexpand Device

You need of mvexpand command because you could have more than one value in Device field.

Ciao.
Giuseppe

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Design, Compete, Win: Submit Your Best Splunk Dashboards for a .conf26 Pass

Hello Splunkers,  We’re excited to kick off a Splunk Dashboard contest! We know that dashboards are a primary ...

May 2026 Splunk Expert Sessions: Security & Observability

Level Up Your Operations: May 2026 Splunk Expert Sessions Whether you are refining your security posture or ...

Network to App: Observability Unlocked [May & June Series]

In today’s digital landscape, your environment is no longer confined to the data center. It spans complex ...