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!

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, ...

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...