processors.enum.mapping to be applied to multiple fields
Feature Request
Proposal:
Make the [processors.enum.mapping] applicable to multiple fields.
Current behavior:
I query a device that gives me json with 8 values that are either "on" or "off". Currently I have to create an [processors.enum.mapping] per value.
[[processors.enum]] [[processors.enum.mapping]] field = "field_1" [processors.enum.mapping.value_mappings] off = 0 on = 1 [[processors.enum.mapping]] field = "field_2" [processors.enum.mapping.value_mappings] off = 0 on = 1 etc.
Desired behavior:
[[processors.enum.mapping]] field = ["field_1", "field_2"] [processors.enum.mapping.value_mappings] off = 0 on = 1
Use case:
It makes the telegraf config more readable and prevents discrepancies.
This makes sense to me. I think we should leave the field setting as a single string for backward compatibility, but we could a another setting called fields that takes an array of strings like you proposed.
@djvanhelmond Would you like to put together a PR to make this change?
@reimda I appreciate the confidence, but I'm not nearly skilled enough to code something up in Go that would be remotely acceptable.