Splunk Search

how can i use like and not like in the same query?

ashidhingra
Path Finder

| where like(RouteCode, "50%") AND !like(RouteCode, "503%")

I am trying to show Routecode 501,2, -- anyother not 503.

Labels (5)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

The negation operator is NOT.

 

| where (like(RouteCode, "50%") AND NOT like(RouteCode, "503%"))

 

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

View solution in original post

richgalloway
SplunkTrust
SplunkTrust

The negation operator is NOT.

 

| where (like(RouteCode, "50%") AND NOT like(RouteCode, "503%"))

 

---
If this reply helps you, Karma would be appreciated.
Get Updates on the Splunk Community!

Developer Spotlight with Brett Adams

In our third Spotlight feature, we're excited to shine a light on Brett—a Splunk consultant, innovative ...

Index This | What can you do to make 55,555 equal 500?

April 2025 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with this ...

Say goodbye to manually analyzing phishing and malware threats with Splunk Attack ...

In today’s evolving threat landscape, we understand you’re constantly bombarded with phishing and malware ...