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
|
|
|
|
2018-07-03 23:10:55 +00:00
|
|
|
### Configuration:
|
2018-07-03 22:32:52 +00:00
|
|
|
|
2018-07-03 23:10:55 +00:00
|
|
|
```toml
|
|
|
|
[[processors.enum]]
|
2018-09-11 23:03:47 +00:00
|
|
|
[[processors.enum.mapping]]
|
2018-07-03 23:10:55 +00:00
|
|
|
## Name of the field to map
|
2018-09-11 23:03:47 +00:00
|
|
|
field = "status"
|
2018-07-03 23:10:55 +00:00
|
|
|
|
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.
|
2018-12-11 00:14:20 +00:00
|
|
|
dest = "status_code"
|
2018-07-03 23:10:55 +00:00
|
|
|
|
|
|
|
## Default value to be used for all values not contained in the mapping
|
2019-10-08 01:08:35 +00:00
|
|
|
## table. When unset and no match is found, the original field will remain
|
|
|
|
## unmodified and the destination tag or field will not be created.
|
2018-07-03 23:10:55 +00:00
|
|
|
# default = 0
|
|
|
|
|
|
|
|
## Table of mappings
|
2018-09-11 23:03:47 +00:00
|
|
|
[processors.enum.mapping.value_mappings]
|
|
|
|
green = 1
|
|
|
|
amber = 2
|
|
|
|
red = 3
|
|
|
|
```
|
|
|
|
|
|
|
|
### Example:
|
|
|
|
|
|
|
|
```diff
|
|
|
|
- xyzzy status="green" 1502489900000000000
|
|
|
|
+ xyzzy status="green",status_code=1i 1502489900000000000
|
2018-07-03 23:10:55 +00:00
|
|
|
```
|
2019-10-08 01:08:35 +00:00
|
|
|
|
|
|
|
With unknown value and no default set:
|
|
|
|
```diff
|
|
|
|
- xyzzy status="black" 1502489900000000000
|
|
|
|
+ xyzzy status="black" 1502489900000000000
|
|
|
|
```
|