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!

Dashboards: Hiding charts while search is being executed and other uses for tokens

There are a couple of features of SimpleXML / Classic dashboards that can be used to enhance the user ...

Splunk Observability Cloud's AI Assistant in Action Series: Explaining Metrics and ...

This is the fourth post in the Splunk Observability Cloud’s AI Assistant in Action series that digs into how ...

Brains, Bytes, and Boston: Learn from the Best at .conf25

When you think of Boston, you might picture colonial charm, world-class universities, or even the crack of a ...