[solved] Telegraf [[inputs.httpjson]] - add tags from sub-fields

telegraf
#1

Hello,

How do I get the sub-fields with strings?
e.g. there is a gitlab_readiness with

{
   "shared_state_check" : {
      "status" : "ok"
   },
   "redis_check" : {
      "status" : "ok"
   },
   "fs_shards_check" : {
      "labels" : {
         "shard" : "default"
      },
      "status" : "ok"
   },
   "db_check" : {
      "status" : "ok"
   },
   "cache_check" : {
      "status" : "ok"
   },
   "queues_check" : {
      "status" : "ok"
   }
}

As httpjson does only parse strings when added as tag_keys, I tried using

  tag_keys = [ "db_check_status" ]
  tag_keys = [ "db_check['status']" ]

However, the collection is always empty. What is the right syntax to get these fields?

Or do I have to wait for: https://github.com/influxdata/telegraf/issues/1363 ?

(edited: syntax)

#2

Yeah, you will need 1363 to be able to parse this.

1 Like