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!

Introducing the 2024 SplunkTrust!

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

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...