默认值处理器插件
此插件允许为字段和标签指定默认值,以防标签或字段不存在或具有空值。
引入于: Telegraf v1.15.0 标签: 转换 操作系统支持: all
全局配置选项
插件支持其他全局和插件配置设置,用于修改指标、标签和字段,创建别名以及配置插件顺序等任务。更多详情请参阅 CONFIGURATION.md。
配置
## Set default fields and tags on your metric(s) when they are nil or empty
[[processors.defaults]]
## Ensures a set of fields or tags always exists on your metric(s) with their
## respective default value.
## For any given field/tag pair (key = default), if it's not set, a field/tag
## is set on the metric with the specified default.
##
## A field is considered not set if it is nil on the incoming metric;
## or it is not nil but its value is an empty string or is a string
## of one or more spaces.
## <target-field> = <value>
[processors.defaults.fields]
field_1 = "bar"
time_idle = 0
is_error = true
## A tag is considered not set if it is nil on the incoming metric;
## or it is not nil but it is empty string or a string of one or
## more spaces.
## <target-tag> = <value>
[processors.defaults.tags]
tag_1 = "foo"示例
当指标中默认未设置 status_code 字段时,确保在指标中插入一个值为 N/A 的 status_code 字段
[[processors.defaults]]
[processors.defaults.fields]
status_code = "N/A"- lb,http_method=GET cache_status=HIT,latency=230
+ lb,http_method=GET cache_status=HIT,latency=230,status_code="N/A"
确保空字符串被默认值替换
- lb,http_method=GET cache_status=HIT,latency=230,status_code=""
+ lb,http_method=GET cache_status=HIT,latency=230,status_code="N/A"
此页面是否有帮助?
感谢您的反馈!
支持和反馈
感谢您成为我们社区的一员!我们欢迎并鼓励您对 Telegraf 和本文档提出反馈和 bug 报告。要获取支持,请使用以下资源
具有年度合同或支持合同的客户可以 联系 InfluxData 支持。