文件输入插件
此插件在每个间隔读取配置文件的完整内容。文件内容按行分割,并根据支持的 数据格式之一进行解析。
如果您只想处理新追加的行,请改用 tail 输入插件。
引入于: Telegraf v1.8.0 标签: system 操作系统支持: all
全局配置选项
插件支持其他全局和插件配置设置,用于修改指标、标签和字段,创建别名以及配置插件顺序等任务。更多详情请参阅 CONFIGURATION.md。
配置
# Parse a complete file each interval
[[inputs.file]]
## Files to parse each interval. Accept standard unix glob matching rules,
## as well as ** to match recursive files and directories.
files = ["/tmp/metrics.out"]
## Character encoding to use when interpreting the file contents. Invalid
## characters are replaced using the unicode replacement character. When set
## to the empty string the data is not decoded to text.
## ex: character_encoding = "utf-8"
## character_encoding = "utf-16le"
## character_encoding = "utf-16be"
## character_encoding = ""
# character_encoding = ""
## Data format to consume.
## Each data format has its own unique set of configuration options, read
## more about them here:
## https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_INPUT.md
data_format = "influx"
## Please use caution when using the following options: when file name
## variation is high, this can increase the cardinality significantly. Read
## more about cardinality here:
## https://docs.influxdb.org.cn/influxdb/cloud/reference/glossary/#series-cardinality
## Name of tag to store the name of the file. Disabled if not set.
# file_tag = ""
## Name of tag to store the absolute path and name of the file. Disabled if
## not set.
# file_path_tag = ""Metrics
此插件生成的指标的格式取决于文件的内容和数据格式。
示例输出
此页面是否有帮助?
感谢您的反馈!
支持和反馈
感谢您成为我们社区的一员!我们欢迎并鼓励您对 Telegraf 和本文档提出反馈和 bug 报告。要获取支持,请使用以下资源
具有年度合同或支持合同的客户可以 联系 InfluxData 支持。