过滤器处理器插件
此插件允许指定一组规则来处理指标,并具有保留或删除这些指标的能力。它不修改指标。因此,用户可能希望应用此处理器来从处理/输出流中删除指标。
过滤不是特定于输出的,而是将应用于此处理器处理的指标。
引入于: Telegraf v1.29.0 标签: 过滤 操作系统支持: all
全局配置选项
插件支持其他全局和插件配置设置,用于修改指标、标签和字段,创建别名以及配置插件顺序等任务。更多详情请参阅 CONFIGURATION.md。
配置
# Filter metrics by the given criteria
[[processors.filter]]
## Default action if no rule applies
# default = "pass"
## Rules to apply on the incoming metrics (multiple rules are possible)
## The rules are evaluated in order and the first matching rule is applied.
## In case no rule matches the "default" is applied.
## All filter criteria in a rule must apply for the rule to match the metric.
## The criteria are combined by a logical AND. If a criterion is
## omitted, it is NOT applied at all and ignored.
[[processors.filter.rule]]
## List of metric names to match including glob expressions
# name = []
## List of tag key/values pairs to match including glob expressions
## ALL given tags keys must exist and at least one value must match
## for the metric to match the rule.
# tags = {}
## List of field keys to match including glob expressions
## At least one field must exist for the metric to match the rule.
# fields = []
## Action to apply for this rule
## "pass" will keep the metric and pass it on, while "drop" will remove
## the metric
# action = "drop"示例
考虑一个场景,您收集了一堆指标
machine,source="machine1",status="OK" operating_hours=37i,temperature=23.1
machine,source="machine2",status="warning" operating_hours=1433i,temperature=48.9,message="too hot"
machine,source="machine3",status="OK" operating_hours=811i,temperature=29.5
machine,source="machine4",status="failure" operating_hours=1009i,temperature=67.3,message="temperature alert"但只想保留那些指示 status 为 failure 或 warning 的指标
[[processors.filter]]
namepass = ["machine"]
default = "drop"
[[processors.filter.rule]]
tags = {"status" = ["warning", "failure"]}
action = "pass"或者,您可以通过以下方式“黑名单” OK 值
[[processors.filter]]
namepass = ["machine"]
[[processors.filter.rule]]
tags = {"status" = ["OK"]}此页面是否有帮助?
感谢您的反馈!
支持和反馈
感谢您成为我们社区的一员!我们欢迎并鼓励您对 Telegraf 和本文档提出反馈和 bug 报告。要获取支持,请使用以下资源
具有年度合同或支持合同的客户可以 联系 InfluxData 支持。