When tested I get the following error due to the string value in the payload 2023-01-22T16:59:12Z E! [inputs.mqtt_consumer] Error in plugin: strconv.ParseFloat: parsing "10:48:31": invalid syntax
I tried adding the following directive for tagdrop but the error is still encountered:
The above filtering works fine for messages which contain the float values.
However I am unable to filter the odd one out which contains the string payload.
My conlusion is that the error is hit before coming to this part of the configuration.
Can anybody suggest to me on how to exclude following topic:
I’d say keep the value as string and filter the metrics with tagdrop as you’ve already tried ([inputs.mqtt_consumer.tagdrop])
Then apply the processor converter to cast the datatype to float. If you have multiple inputs you may want to add tagpass (or whatever selectors you find appropriate) in order to apply the cast only to those data
# # Convert values to another metric value type
[[processors.converter]]
# ## Fields to convert
# ##
# ## The table key determines the target type, and the array of key-values
# ## select the keys to convert. The array may contain globs.
# ## <target-type> = [<field-key>...]
[processors.converter.fields]
# tag = []
# string = []
# integer = []
# unsigned = []
# boolean = []
# use glob * to catch all field names
float = ["*"]