字段类型与 [input.tail] 插件冲突
Field type conflict with [input.tail] plugin
我正在尝试使用 Telegraf 的 input.tail 插件将数据从我的 csv 文件导入 InfluxDB。
我可以在不明确字段类型的情况下导入数据。问题是我想将数据从 csv 合并到已经存在的 measurement
,其中有 float 类型。我发现我们可以通过在 tail 插件中使用 csv_column_types
来显式更改类型,但并不缺少。
telegraf.conf
[[inputs.tail]]
## files to tail.
## These accept standard unix glob matching rules, but with the addition of
## ** as a "super asterisk". ie:
## "/var/log/**.log" -> recursively find all .log files in /var/log
## "/var/log/*/*.log" -> find all .log files with a parent dir in /var/log
## "/var/log/apache.log" -> just tail the apache log file
##
## See https://github.com/gobwas/glob for more examples
##
files = ["test.csv"]
## Read file from beginning.
from_beginning = true
## Whether file is a named pipe
pipe = false
## Method used to watch for file updates. Can be either "inotify" or "poll".
# watch_method = "inotify"
## 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 = "csv"
csv_header_row_count = 1
#csv_column_names = ["time","sentBytes","success"]
csv_column_types =["float","float", "string"]
test.csv
"time","sentBytes","success"
"1564763737220","4345","true"
我也试过 [processors.converter.tags]
- 不缺。
错误信息是when writing to [http://localhost:8086]: received error partial write: field type conflict: input field "sentBytes" on measurement "tail" is type float, already exists as type integer dropped=5000; discarding points
。
telegraf --version
Telegraf 1.11.0 (git: HEAD c9d8f7b0)
有人可以澄清我做错了什么吗?
据我了解,tail插件使用InfluxDB线路协议,发送|measurement|,tag_set| |field_set| |timestamp|
基于此我添加了csv_tag_columns=["success"]
并将csv_column_types
更改为
csv_column_types=["string","float"]
现在可以使用了
我正在尝试使用 Telegraf 的 input.tail 插件将数据从我的 csv 文件导入 InfluxDB。
我可以在不明确字段类型的情况下导入数据。问题是我想将数据从 csv 合并到已经存在的 measurement
,其中有 float 类型。我发现我们可以通过在 tail 插件中使用 csv_column_types
来显式更改类型,但并不缺少。
telegraf.conf
[[inputs.tail]]
## files to tail.
## These accept standard unix glob matching rules, but with the addition of
## ** as a "super asterisk". ie:
## "/var/log/**.log" -> recursively find all .log files in /var/log
## "/var/log/*/*.log" -> find all .log files with a parent dir in /var/log
## "/var/log/apache.log" -> just tail the apache log file
##
## See https://github.com/gobwas/glob for more examples
##
files = ["test.csv"]
## Read file from beginning.
from_beginning = true
## Whether file is a named pipe
pipe = false
## Method used to watch for file updates. Can be either "inotify" or "poll".
# watch_method = "inotify"
## 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 = "csv"
csv_header_row_count = 1
#csv_column_names = ["time","sentBytes","success"]
csv_column_types =["float","float", "string"]
test.csv
"time","sentBytes","success"
"1564763737220","4345","true"
我也试过 [processors.converter.tags]
- 不缺。
错误信息是when writing to [http://localhost:8086]: received error partial write: field type conflict: input field "sentBytes" on measurement "tail" is type float, already exists as type integer dropped=5000; discarding points
。
telegraf --version
Telegraf 1.11.0 (git: HEAD c9d8f7b0)
有人可以澄清我做错了什么吗?
据我了解,tail插件使用InfluxDB线路协议,发送|measurement|,tag_set| |field_set| |timestamp|
基于此我添加了csv_tag_columns=["success"]
并将csv_column_types
更改为
csv_column_types=["string","float"]
现在可以使用了