Filters
Facette filters allow you to change how origins, sources and metrics appear in the Facette catalog, and
discard the ones you don’t want to deal with. The filters
section of a provider definition defines rules that are
evaluated at origins inventory, renaming or discarding specific sources or metrics using regular expressions
(RE2 syntax).
\
when writing regular expressions
(e.g. \d
→ \\d
).Filter rule settings:
action
(string): action to perform on the processed records (see “Actions” section)target
(string): object to target (origin
,source
,metric
orall
)pattern
(string): pattern to matchinto
(string): replacement pattern
Supported target
(string) values:
all
: match filterpattern
on all names (default)origin
: match filterpattern
on origin names onlysource
: match filterpattern
on source names onlymetric
: match filterpattern
on metric names only
Actions
rewrite
Rewrite all received records target
field by replacing all occurrences of pattern
with the string value
specified in the rewrite
setting (can also be regular expression captured groups references).
Example: rewrite sources (such as “host3_example_net” becomes “host3.example.net”), and metrics (such as “cpu-0.cpu.system.value” becomes “cpu.0.system”):
"filters": [
{ "action": "rewrite", "target": "source", "pattern": "_", "into": "." },
{ "action": "rewrite", "target": "metric", "pattern": "^cpu-(\\d+)\\.cpu-(.+)\\.value$", "into": "cpu.$1.$2" }
]
discard
Discard all received records whose target
match pattern
.
Example: discard all entries whose source match the pattern “host3.example.net”
"filters": [
{ "action": "discard", "target": "source", "pattern": "host3\\.example\\.net" }
]
sieve
The sieve action does the opposite of discard: it only lets records whose target
match pattern
pass through.
Example: only keep records whose source names end with “.prod.example.net”
"filters": [
{ "action": "sieve", "target": "source", "pattern": "\\.prod\\.example\\.net$" }
]
Precedence
When evaluating filtering chains, the precedence of actions is the following:
Sieve > Discard > Rewrite