66 lines
2.8 KiB
Text
66 lines
2.8 KiB
Text
# Transforms tag and field values as well as measurement, tag and field names with regex pattern
|
|
[[processors.regex]]
|
|
namepass = ["nginx_requests"]
|
|
|
|
## Tag value conversion(s). Multiple instances are allowed.
|
|
[[processors.regex.tags]]
|
|
## Tag(s) to process with optional glob expressions such as '*'.
|
|
key = "resp_code"
|
|
## Regular expression to match the tag value. If the value doesn't
|
|
## match the tag is ignored.
|
|
pattern = "^(\\d)\\d\\d$"
|
|
## Replacement expression defining the value of the target tag. You can
|
|
## use regexp groups or named groups e.g. ${1} references the first group.
|
|
replacement = "${1}xx"
|
|
## Name of the target tag defaulting to 'key' if not specified.
|
|
## In case of wildcards being used in `key` the currently processed
|
|
## tag-name is used as target.
|
|
# result_key = "method"
|
|
## Appends the replacement to the target tag instead of overwriting it when
|
|
## set to true.
|
|
# append = false
|
|
|
|
## Field value conversion(s). Multiple instances are allowed.
|
|
[[processors.regex.fields]]
|
|
## Field(s) to process with optional glob expressions such as '*'.
|
|
key = "request"
|
|
## Regular expression to match the field value. If the value doesn't
|
|
## match or the field doesn't contain a string the field is ignored.
|
|
pattern = "^/api(?P<method>/[\\w/]+)\\S*"
|
|
## Replacement expression defining the value of the target field. You can
|
|
## use regexp groups or named groups e.g. ${method} references the group
|
|
## named "method".
|
|
replacement = "${method}"
|
|
## Name of the target field defaulting to 'key' if not specified.
|
|
## In case of wildcards being used in `key` the currently processed
|
|
## field-name is used as target.
|
|
# result_key = "method"
|
|
|
|
## Rename metric fields
|
|
[[processors.regex.field_rename]]
|
|
## Regular expression to match on the field name
|
|
pattern = "^search_(\\w+)d$"
|
|
## Replacement expression defining the name of the new field
|
|
replacement = "${1}"
|
|
## If the new field name already exists, you can either "overwrite" the
|
|
## existing one with the value of the renamed field OR you can "keep"
|
|
## both the existing and source field.
|
|
# result_key = "keep"
|
|
|
|
## Rename metric tags
|
|
[[processors.regex.tag_rename]]
|
|
## Regular expression to match on a tag name
|
|
pattern = "^search_(\\w+)d$"
|
|
## Replacement expression defining the name of the new tag
|
|
replacement = "${1}"
|
|
## If the new tag name already exists, you can either "overwrite" the
|
|
## existing one with the value of the renamed tag OR you can "keep"
|
|
## both the existing and source tag.
|
|
# result_key = "keep"
|
|
|
|
## Rename metrics
|
|
[[processors.regex.metric_rename]]
|
|
## Regular expression to match on an metric name
|
|
pattern = "^search_(\\w+)d$"
|
|
## Replacement expression defining the new name of the metric
|
|
replacement = "${1}"
|