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

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: Support JSON Path-like json parsing · Issue #1363 · influxdata/telegraf · GitHub ?

(edited: syntax)

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

1 Like