Example of how filters are applied

Document ID : KB000097955
Last Modified Date : 24/05/2018
Show Technical Document Details
Question:
I want to create a filter or set of filters so that 1 machine get a series of metrics and another gets another set of metrics. How do I accomplish this?
Answer:
The best way to apply filters is to make a set of filters for each set of machines: 

If you have: 

Machine1 that needs one set of metrics and machine2 needs another, than you will want to create a filter for each and create a rule that is based on the label as an include on each. 

If you have 2 filters, one with a rule and another without than the filters are applied in a cumulative fashion.

Example: 

Fliter 1 with no rule has metrics: 

Memory 
CPU 

Filter 2 with a rule for Machine1 has metric: 

Disk 

Since Machine1 is factored into both filters (no rule to factor it out), one as an include only in the second and as one of many in the 1st it will have the following metrics applied to it 

Memory 
CPU 
Disk 

All other machines will only have: 

Memory 
CPU 

By contrast if I put a rule in filter 1 with only Machine2 than the resulting metrics would look like the following:

Machine1  
Disk

Machine2
Memory 
CPU 

That stated when you are setting a few machines in a single filter you will want to use something like: 

label 
regex 
machine1|machine2|machine3