Telegraf: Add data to records

HI All,

Sorry - bit of a telegraf/influxdb newbie so apologies if this has been asked / answered before…

I’m trying to do the following:

  • For each metric collected by telegraf (globally) tag each datapoint with an entry ‘anomoly’ (value 0/false)

  • I can add it easily as a tag using the global tag definition, but when I need to mark some data as anomalous this will cause issues - I’m thinking it’s better to change a field value

  • I’ve read numerous articles pointing to use of the processors.converter pieces, but unfortunately the info is a little thin on the ground for me to comprehend how to actually do it with my limited understanding.

Does anyone have an example of this sort of conversion of a tag->field using the converter? Or am I doing something completely strange and should reconsider?

Thanks!

Adding this to your configuration will convert the anomaly tag to an integer, the tag will need to be a value that can be converted, such as anomaly=0:

[[processors.converter]]
  [processors.converter.tags]
    integer = ["anomaly"]

Or am I doing something completely strange and should reconsider?

I think maybe, perhaps it would be better to add the field later only if it is an anomaly and treat no field as not anomalous. One downside of switching it to a field is that it will be slow to lookup all points that have anomaly, if you can mark it as an anomaly at ingest time it may be better to add it as a tag.