Splunk Dev

NOT operator issue

splunk_zen
Builder

I'm having trouble applying a filter to group servers which share the scp keyword, into %scp% and %dscp% subgroups. The resulting AND expression does not return any values.
How should I rewrite the NOT sentence ?

case(
NOT (hostname like "%dscp%") AND hostname like "%scp%", "SCPs", 
....
hostname like "%dscp%", "DSCPs",
hostname like "%mgr%", "MGRs"
), 
"other")

EDIT: Also tried the variation

NOT like(HOST_NAME,"%dscp%") AND like(HOST_NAME,"%scp%"), "SCPs", 

with no luck.

Tags (4)
0 Karma

splunk_zen
Builder

Sigh...
Some admin please delete this question.
The initial search was correct.
Turns out some collection process had stopped and that range of hosts were not being updated, that's why I was seeing any results, there weren't any to show..

0 Karma

jonuwz
Influencer
host=*scp* AND host!=*dscp*

or

host=*scp* NOT host=*dscp*

splunk_zen
Builder

Thanks jonuwz,
but it seems case does not play well with that wildcard form:

Error in 'eval' command: The expression is malformed. An unexpected character is reached at '*scp* AND hostname !=*dscp*, "SCPs", hostname =*dscp*, "DSCPs"

If I encapsulate the wildcards with quotes,

hostnam == "*scp*" AND host!="*dscp*"

it just does not find anything as it explicitly searches for the string "scp" ('*' characters included)

0 Karma
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...