Tag-based filtering of json-data obtained through http input plugin

Hi,
I am retrieving json-data with the http input plugin.

json-data example:

[
   {
      "SensorID" : "123",
      "Value" : 15.68,
      "dt" : "2022-05-10 10:49:09"
   },
   {
      "SensorID" : "125",
      "Value" : 12.45,
      "dt" : "2022-05-10 10:49:09"
   },
   ...
]

telegraf.conf

[[inputs.http]]
  urls = ["http://localhost/"]
  tagexclude = ["url", "host"]
  data_format = "json_v2"
  [[inputs.http.json_v2]]
    measurement_name = "measurement"
    [[inputs.http.json_v2.object]]
      path = "@this"
      tags = ["SensorID"]  
      timestamp_key = "dt"
      timestamp_format = "2006-01-02 15:04:05"

Now I would like to register only data in the database where the tag SensorID is equal to 123.

How can this be achieved?

Many thanks for your help!

You can use tagpass for metric filtering:

Configuring Telegraf | Telegraf 1.21 Documentation

1 Like