Splunk Enterprise Security

Correct way to use NOT match

jacqu3sy
Path Finder

Hi,

Whats the correct syntax to use when trying to return results where two fields DO NOT match?

Trying the following, but not within any great success;

| where NOT match(field A, field B)

Thanks.

0 Karma
1 Solution

efavreau
Motivator

There are lots of ways to solve this. I might go with something like:

| makeresults 
| eval fieldA="12345" 
| eval fieldB="1234" 
| eval DoTheyMatch=case(
    fieldA = fieldB,"TheyMatch",
    1==1, "TheyDoNotMatch"
    ) 
| where DoTheyMatch="TheyDoNotMatch"

To go to the docs, be aware of the following background information:
https://docs.splunk.com/Documentation/Splunk/Latest/Search/NOTexpressions
https://docs.splunk.com/Documentation/Splunk/Latest/SearchReference/ConditionalFunctions

###

If this reply helps you, an upvote would be appreciated.

View solution in original post

0 Karma

acfecondo75
Path Finder

| makeresults
| eval fieldA=123, fieldB=321
| where fieldA!=fieldB

0 Karma

efavreau
Motivator

There are lots of ways to solve this. I might go with something like:

| makeresults 
| eval fieldA="12345" 
| eval fieldB="1234" 
| eval DoTheyMatch=case(
    fieldA = fieldB,"TheyMatch",
    1==1, "TheyDoNotMatch"
    ) 
| where DoTheyMatch="TheyDoNotMatch"

To go to the docs, be aware of the following background information:
https://docs.splunk.com/Documentation/Splunk/Latest/Search/NOTexpressions
https://docs.splunk.com/Documentation/Splunk/Latest/SearchReference/ConditionalFunctions

###

If this reply helps you, an upvote would be appreciated.
0 Karma

starcher
SplunkTrust
SplunkTrust

as mentioned many ways

 | makeresults 
 | eval fieldA="12345" 
 | eval fieldB="1234"
 | where !like(fieldA,fieldB)
0 Karma

jacqu3sy
Path Finder

Thanks all. Was overthinking things.

0 Karma

adonio
Ultra Champion

| where A!=B

Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...