Nikita Lipatov
Nikita Lipatov

Reputation: 43

Telegraf - input tail plugin error (Error: metric parse error: expected field at offset)

I want to read a plain text file. For this I use Tail Input Plugin. The configuration file is this:

[[inputs.tail]]
files = 
["/home/nikitalipatov/Programing/Projects/Diploma/TestData/test.txt"]
from_beginning = true
data_format = "influx"

[[outputs.file]]
files = ["stdout", 
"/home/nikitalipatov/Programing/Projects/Diploma/TestData/log.text"]
data_format = "influx"

Contents of the text file:

data1
data2
data3

But when I try to start Telegraf, I get this kind of error:

telegraf[14541]: 2018-05-16T16:46:24Z E! Error in plugin [inputs.tail]: E! Malformed log line in /home/nikitalipatov/Programing/Projects/Diploma/TestData/1.txt: [data1], Error: metric parse error: expected field at offset 5: "data1\n"

Upvotes: 1

Views: 7035

Answers (1)

Davidgs
Davidgs

Reputation: 419

The error is telling you what's wrong. That text file does not contain valid InfluxDB Line protocol for data. You have specified the data format as "influx" which means line protocol, so your data needs to conform to Line Protocol format.

measurement,tag=value value=data1,value=data2 timestamp

If you conform your data to that format, your data should load.

Best regards, dg

Upvotes: 4

Related Questions