Telegraf [inputs.tail] not picking up Field as Float

#1

Hi,

Im using Input.tail to follow a json file. Everything works fine but i cannot seem to get the one of the field as a float.

I can specify using the json_string_fields but then it would store the value as a string which i do not want.

Highlighted is the field that i want to store as a float type but seems like teelgraf is not importing it into influx db at all.

When specified within json_string_fields , it works but it stores as a string.

json_string_fields = [“Session”]

[[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 = [“D:/Logs/Apps/StatisticsGateway/Statistics.Performance.json”]

Read file from beginning.

from_beginning = false

Whether file is a named pipe

pipe = false

Method used to watch for file updates. Can be either “inotify” or “poll”.

watch_method = “poll”

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 = “json”
tag_keys = [“UserName”,“MetricName”,“MetricUnit”,“logger”]
json_string_fields = [“Session”]

#2

You can add a processor for this:

[input.tail]
  ...
  [processors.converter.fields]
    float = ["Session"]
#3

nice one worked . Config as below for converter