值计数器聚合器插件
此插件计算字段中唯一值的出现次数,并每 period 发出一次计数器,字段名称后缀为转换为 string 的唯一值。
要计数的字段必须使用 fields 设置进行配置,否则将不计数任何字段,也不会发出任何指标。
此插件对于例如在定义的 period 内计算 HTTP 状态码或其他分类值的出现次数非常有用。
计数具有大量潜在值的字段可能会产生大量新字段,并导致内存使用量增加。请注意仅计数具有有限值集的字段。
引入版本: Telegraf v1.8.0 标签: statistics 操作系统支持: all
全局配置选项
插件支持其他全局和插件配置设置,用于修改指标、标签和字段,创建别名以及配置插件顺序等任务。更多详情请参阅 CONFIGURATION.md。
配置
# Count the occurrence of values in fields.
[[aggregators.valuecounter]]
## General Aggregator Arguments:
## The period on which to flush & clear the aggregator.
# period = "30s"
## If true, the original metric will be dropped by the
## aggregator and will not get sent to the output plugins.
# drop_original = false
## The fields for which the values will be counted
fields = ["status"]测量值 & 字段
- measurement1
- field_value1
- field_value2
标签
此聚合器不应用任何标签。
示例输出
用于解析 HTTP 访问日志的示例。
telegraf.conf
[[inputs.logparser]]
files = ["/tmp/tst.log"]
[inputs.logparser.grok]
patterns = ['%{DATA:url:tag} %{NUMBER:response:string}']
measurement = "access"
[[aggregators.valuecounter]]
namepass = ["access"]
fields = ["response"]/tmp/tst.log
/some/path 200
/some/path 401
/some/path 200access,url=/some/path,path=/tmp/tst.log,host=localhost.localdomain response="200" 1511948755991487011
access,url=/some/path,path=/tmp/tst.log,host=localhost.localdomain response="401" 1511948755991522282
access,url=/some/path,path=/tmp/tst.log,host=localhost.localdomain response="200" 1511948755991531697
access,path=/tmp/tst.log,host=localhost.localdomain,url=/some/path response_200=2i,response_401=1i 1511948761000000000此页面是否有帮助?
感谢您的反馈!
支持和反馈
感谢您成为我们社区的一员!我们欢迎并鼓励您对 Telegraf 和本文档提出反馈和 bug 报告。要获取支持,请使用以下资源
具有年度合同或支持合同的客户可以 联系 InfluxData 支持。