Hi, I am using Logstash to parse and enter graphite metrics into InfluxDB. However, I wanted to create a large dictionary source where it can match certain metric lines based on their pattern and reorganize the string based on the delimiter - "."
I know the translate filter can do this, also it can be done via mutate and gsub. I could not find documentation on how to use the regex to create capture groups and place them in the resultant string. Example:
job.cm_attributes.timer.CMTopology.processor.DiscoveryResponse.succeeded
job.cm_equalization.timer.CMHierarchy.processor.ExplorerResponse.succeeded
I would like the above two to be reorganized to:
timer.CMTopology.job.cm_attributes.processor.DiscoveryResponse.succeeded
timer.CMHierarchy.job.cm_equalization.processor.ExplorerResponse.succeeded
Notice that the fields are slightly swapped around, that's all. Would I be able to do this through some kind of capture group in translate (note the $1,2,3,4 are the captured groups)?
field => "name"
exact => true
regex => true
destination => "name"
override => "true"
dictionary => [
"job\.(^[^.]+$)\.timer\.(^[^.]+$)\.processor\.(^[^.]+$)\.(.*)", "timer.$2.job.$1.processor.$3.$4"
]
}
If I need to use gsub for this, anyone know if I can source the mapping like translate can from a different file?