We're using telegraf to collect CloudWatch data from AWS and output it to InfluxDB.
We need to add dynamic tags to the input, s.t if "instancId == 12345"
, add tag "user = 3"
Is there a way to do this?
Take a look at the processors
. If you have just a set of known values that you want to work with, I think enum
would be the best option. Here is the example updated for your case:
[[processors.enum]]
[[processors.enum.mapping]]
## Name of the field to map
field = "instancId"
## Destination field to be used for the mapped value. By default the source
## field is used, overwriting the original value.
dest = "user"
## Default value to be used for all values not contained in the mapping
## table. When unset, the unmodified value for the field will be used if no
## match is found.
default = 0
## Table of mappings
[processors.enum.mapping.value_mappings]
123 = 1
1234 = 2
12345 = 3
See the CONFIGURATION.md docs:
[[inputs.cpu]]
percpu = false
totalcpu = true
[inputs.cpu.tags]
tag1 = "foo"
tag2 = "bar"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With