telegraf/plugins/processors/enum/README.md

45 lines
1.4 KiB
Markdown
Raw Normal View History

2018-07-03 22:32:52 +00:00
# Enum Processor Plugin
2019-05-16 22:59:19 +00:00
The Enum Processor allows the configuration of value mappings for metric tags or fields.
2018-07-03 22:32:52 +00:00
The main use-case for this is to rewrite status codes such as _red_, _amber_ and
_green_ by numeric values such as 0, 1, 2. The plugin supports string and bool
2019-05-16 22:59:19 +00:00
types for the field values. Multiple tags or fields can be configured with separate
value mappings for each. Default mapping values can be configured to be
2018-07-03 22:32:52 +00:00
used for all values, which are not contained in the value_mappings. The
2019-05-16 22:59:19 +00:00
processor supports explicit configuration of a destination tag or field. By default the
source tag or field is overwritten.
2018-07-03 22:32:52 +00:00
### Configuration:
2018-07-03 22:32:52 +00:00
```toml
[[processors.enum]]
[[processors.enum.mapping]]
## Name of the field to map
field = "status"
2019-05-16 22:59:19 +00:00
## Name of the tag to map
# tag = "status"
## Destination tag or field to be used for the mapped value. By default the
## source tag or field is used, overwriting the original value.
dest = "status_code"
## 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]
green = 1
amber = 2
red = 3
```
### Example:
```diff
- xyzzy status="green" 1502489900000000000
+ xyzzy status="green",status_code=1i 1502489900000000000
```