influxdbtelegraftelegraf-inputs-plugintelegraf-plugins

Field type conflict with [input.tail] plugin


I'm trying to import the data from my csv file to InfluxDB by using Telegraf's input.tail plugin.

I'm able to import the data without expliciting the type of the fields. The problem is that I want to merge the data from csv to already existing measurement, which has float types in it. I've found that we can explicitly change the types by using csv_column_types in tail plugin, but no lack.

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"

I've tried [processors.converter.tags] as well - no lack.

Error message is 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)

Can someone clarify what I'm doing wrong?


Solution

  • As far as I understand, tail plugin uses InfluxDB line protocol, which sends |measurement|,tag_set| |field_set| |timestamp| Based on this I've added csv_tag_columns=["success"] and changed csv_column_types to csv_column_types=["string","float"] and now it's working