Telegraf // Parse and transform JSON

Hey there,

I’m trying since multiple hours to get some JSON data into influxdb. :sweat_smile: The problem is the following - this is how my JSON looks like:

{
	"number":"FKAISS2141",
	"time":"2018-12-03 13:18:32.897 +01:00",
	"DATA":{
		"SEQ":{
			"X":"55.56722",
			"Y":"-656.1673",
			"Z":"3172.665",
			"A":"72.68263",
			"B":"25.55068",
			"C":"-78.9617"
			}
		}
}

These values are coordinates, so I dont want them to be aggregated. Independently of that I need to cast/convert all the numbers in quotes to actual numbers. For this I’m using the following processor:

[[processors.converter]]
  [processors.converter.fields]
    float = ["DATA.SEQ.X", "DATA.SEQ.Y", "DATA.SQR.Z"]

But it seems like the processor does not convert the data types. Since I can’t apply any aggregation function in influx those values seem to be still strings. In addition I’m not sure about the json_string_fields and tag keys. And how should I call the fields in the processor? Is the GJSON-Rule already applied?

This is my whole config file:

[global_tags]
  
[agent]
 
  interval = "10s"
  round_interval = true
  metric_batch_size = 1000
  metric_buffer_limit = 10000
  collection_jitter = "0s"
  flush_interval = "10s"
  flush_jitter = "0s"
  precision = ""
  debug = false
  quiet = false
  logfile = ""
  hostname = ""
  omit_hostname = false

###############################################################################
#                            OUTPUT PLUGINS                                   #
###############################################################################

[[outputs.influxdb]]
  urls = ["http://influxdb_1:8086"]
  database = "db01"

###############################################################################
#                            INPUT PLUGINS                                    #
###############################################################################

[[inputs.kafka_consumer]]

    name_override = "kfk_rbts310"
    brokers = ["kafka01:9092"]
    topics = ["rbts310ax"]
    consumer_group = "telegraf_metrics_consumers"
    offset = "newest"
    data_format = "json"
    json_query = "DATA.SEQ"
#   tag_keys = ["X","Y","Z"]
    json_string_fields = ["X","Y","Z"]
    max_message_len = 100000000

[[processors.converter]]
  [processors.converter.fields]
    float = ["DATA.SEQ.X", "DATA.SQE.Y", "DATA.SEQ.Z"]

Cheers

Can you show the expected output versus the actual output?