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
Influencer

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!

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...

New! Splunk Observability Search Enhancements for Splunk APM Services/Traces and ...

Regardless of where you are in Splunk Observability, you can search for relevant APM targets including service ...

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...