Splunk Search

Ignoring multiple values from field

JoshuaJohn
Contributor

Brain must not be working today. This should be a simple one. I am trying to ignore multiple values from a field... This works but I would rather not do it this way.

| search SNumber != 9901
| search SNumber != 9900
| search SNumber != 9712
| search SNumber != 9709
| search SNumber!= 8004
| search SNumber != 8001
| search SNumber != 6666

I tried
|search SNumber !=9901,9900,9712,9709,8004,8001,6666
|search SNumber !=(9901,9900,9712,9709,8004,8001,6666)
|search SNumber NOT (9901,9900,9712,9709,8004,8001,6666)
|where SNumber !=9901 OR 9900 OR 9712 OR 9709 OR 8004 OR 8001 OR 6666
to no avail

0 Karma
1 Solution

horsefez
Motivator

Hi,

try some variants like this.

your_inital_search AND NOT (SNumber = 9901 OR SNumber = 9900 OR SNumber = 9712 ... )

or try it with where-command

| where NOT (like(SNumber, "9901") OR like(Snumber, "9900") OR ....)

or

| where NOT (SNumber="9901" OR SNumber="9900" OR ...)

Your variants will not work.

View solution in original post

0 Karma

horsefez
Motivator

Hi,

try some variants like this.

your_inital_search AND NOT (SNumber = 9901 OR SNumber = 9900 OR SNumber = 9712 ... )

or try it with where-command

| where NOT (like(SNumber, "9901") OR like(Snumber, "9900") OR ....)

or

| where NOT (SNumber="9901" OR SNumber="9900" OR ...)

Your variants will not work.

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...