2018-05-23 21:29:57 +00:00
|
|
|
# Converter Processor
|
|
|
|
|
|
|
|
The converter processor is used to change the type of tag or field values. In
|
2018-06-11 21:43:28 +00:00
|
|
|
addition to changing field types it can convert between fields and tags.
|
2018-05-23 21:29:57 +00:00
|
|
|
|
|
|
|
Values that cannot be converted are dropped.
|
|
|
|
|
2018-06-12 23:12:08 +00:00
|
|
|
**Note:** When converting tags to fields, take care to ensure the series is still
|
2018-05-23 21:29:57 +00:00
|
|
|
uniquely identifiable. Fields with the same series key (measurement + tags)
|
|
|
|
will overwrite one another.
|
|
|
|
|
2020-03-09 21:08:38 +00:00
|
|
|
### Configuration
|
2018-05-23 21:29:57 +00:00
|
|
|
```toml
|
|
|
|
# Convert values to another metric value type
|
2018-08-23 20:11:39 +00:00
|
|
|
[[processors.converter]]
|
2018-05-23 21:29:57 +00:00
|
|
|
## Tags 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> = [<tag-key>...]
|
|
|
|
[processors.converter.tags]
|
2020-03-09 21:08:38 +00:00
|
|
|
measurement = []
|
2018-05-23 21:29:57 +00:00
|
|
|
string = []
|
|
|
|
integer = []
|
|
|
|
unsigned = []
|
|
|
|
boolean = []
|
|
|
|
float = []
|
|
|
|
|
|
|
|
## 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]
|
2020-03-09 21:08:38 +00:00
|
|
|
measurement = []
|
2018-05-23 21:29:57 +00:00
|
|
|
tag = []
|
|
|
|
string = []
|
|
|
|
integer = []
|
|
|
|
unsigned = []
|
|
|
|
boolean = []
|
|
|
|
float = []
|
|
|
|
```
|
|
|
|
|
2020-03-09 21:08:38 +00:00
|
|
|
### Example
|
2018-05-23 21:29:57 +00:00
|
|
|
|
2020-03-09 21:08:38 +00:00
|
|
|
Convert `port` tag to a string field:
|
2018-05-23 21:29:57 +00:00
|
|
|
```toml
|
2018-08-23 20:11:39 +00:00
|
|
|
[[processors.converter]]
|
2018-05-23 21:29:57 +00:00
|
|
|
[processors.converter.tags]
|
|
|
|
string = ["port"]
|
2020-03-09 21:08:38 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
```diff
|
|
|
|
- apache,port=80,server=debian-stretch-apache BusyWorkers=1,BytesPerReq=0
|
|
|
|
+ apache,server=debian-stretch-apache port="80",BusyWorkers=1,BytesPerReq=0
|
|
|
|
```
|
2018-05-23 21:29:57 +00:00
|
|
|
|
2020-03-09 21:08:38 +00:00
|
|
|
Convert all `scboard_*` fields to an integer:
|
|
|
|
```toml
|
|
|
|
[[processors.converter]]
|
2018-05-23 21:29:57 +00:00
|
|
|
[processors.converter.fields]
|
|
|
|
integer = ["scboard_*"]
|
|
|
|
```
|
|
|
|
|
|
|
|
```diff
|
2020-03-09 21:08:38 +00:00
|
|
|
- apache scboard_closing=0,scboard_dnslookup=0,scboard_finishing=0,scboard_idle_cleanup=0,scboard_keepalive=0,scboard_logging=0,scboard_open=100,scboard_reading=0,scboard_sending=1,scboard_starting=0,scboard_waiting=49
|
|
|
|
+ apache scboard_closing=0i,scboard_dnslookup=0i,scboard_finishing=0i,scboard_idle_cleanup=0i,scboard_keepalive=0i,scboard_logging=0i,scboard_open=100i,scboard_reading=0i,scboard_sending=1i,scboard_starting=0i,scboard_waiting=49i
|
|
|
|
```
|
|
|
|
|
|
|
|
Rename the measurement from a tag value:
|
|
|
|
```toml
|
|
|
|
[[processors.converter]]
|
|
|
|
[processors.converter.tags]
|
|
|
|
measurement = ["topic"]
|
|
|
|
```
|
|
|
|
|
|
|
|
```diff
|
|
|
|
- mqtt_consumer,topic=sensor temp=42
|
|
|
|
+ sensor temp=42
|
2018-05-23 21:29:57 +00:00
|
|
|
```
|