cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Pro-tip: Exclude entities by tag (find the non-matching entities)

The_AM
Dynatrace Champion
Dynatrace Champion

How do you exclude entities by tagging non-match?

Also known as filter for "negate match" or "does not match".

 

This question comes up from time-to-time, and I'd just responded to the same on another thread. I thought it worthwhile to share as a Dynatrace tip!

 

Option 1)

You could have many tags, it is true. For all the different conditions you could think of.

eg: include or exclude Kubernetes nodes

The_AM_0-1664238177434.png

 

Then say, if you want to exclude Linux-only OS, you would need another tag for 'isLinuxOS': yes/no

For Windows, 'isWindowsOS': yes/no

And so on....

This is cumbersome, I agree.

 

Option 2) [Recommended]

However, an easier way may be to make a tag called "exclude" and all the optional tag values point to the condition you'd like to exclude. You may add many different options here.

 

The_AM_1-1664238177442.png

 

The Results!

You can see here, the results can be quite powerful.

I could exclude all my Kubernetes nodes, to find other types of hosts.

The_AM_2-1664238263602.png

 

It is even possible to combine multiple conditions.

The_AM_3-1664238317168.png

 

Technically, you could filter to the same entity by combining an inclusion and exclusion tag. It all depends on the problem you'd like to solve.

The_AM_4-1664238387869.png

Regards,
Andrew M.
3 REPLIES 3

ChadTurner
DynaMight Legend
DynaMight Legend

very nice little trick to work around that negations of filtering 🙂 Kudos to you @The_AM 

-Chad

Vanguard
Contributor

I do not understand how this work. In the example you use exclude:kubernetes-node, however it seems you set a tag value of non-k8-node in the Rules. Please show details of the configured rule conditions and what tag values have been used and why. I spent 1h trying to follow this tip and gotten nowhere.

The_AM
Dynatrace Champion
Dynatrace Champion

exclude:non-k8s-node matches all Kubernetes nodes (include only K8s nodes). All other servers are excluded.
exclude:kubernetes-node matches all nodes that do not have Kubernetes. All Kubernetes servers are excluded.

These rules do not necessarily cover every use-case and are non-exhaustive.

 

Edit: It's also been about 2 years since this was made, it is possible metadata available has changed.

Regards,
Andrew M.

Featured Posts