Alerting

Is there a way to search where 4 letters in FieldA NotMatch FieldB?

aikn061
Explorer

Hi Guys,

So if I have two fields with really random set of text, no similarities except the red text.  Does have the 'red' fonts in similarity as below.

In this case, is there a way to search to say when first four letters in FieldA exists in FieldB, exclude?

This would be very easy in powershell or python.  I am medium splunk user as well, but not sure how I'd do this in splunk.

This would be very helpful..  Your help is appreciated in advance.  

 

FieldA FieldB
Complete Exch.Complete
NotComplete apps.NotC@
Satisftesting Satiapps
Labels (4)
0 Karma

aikn061
Explorer

Both methods do work - Thanks RichGalloway and Bowesmana

0 Karma

richgalloway
SplunkTrust
SplunkTrust

If your problem is resolved, then please click the "Accept as Solution" button to help future readers.

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

richgalloway
SplunkTrust
SplunkTrust

See if this helps.

 

| eval exclString=substr(FieldA, 1, 4)
| where NOT match(FieldB, exclString)

EDIT: I fixed this answer to exclude rather than include matches.  Thanks, @bowesmana !

 

 

 

---
If this reply helps you, Karma would be appreciated.

bowesmana
SplunkTrust
SplunkTrust

Or the minimalist one liner 😃 - but turning round the logic to exclude rather than include those matching items

| where !match(FieldB, substr(FieldA, 1, 4))

 

Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...