Clarify replacement string behavior in regex processor
This commit is contained in:
parent
ae1aee3207
commit
58e6eb6f07
|
@ -14,10 +14,12 @@ The `regex` plugin transforms tag and field values with regex pattern. If `resul
|
||||||
key = "resp_code"
|
key = "resp_code"
|
||||||
## Regular expression to match on a tag value
|
## Regular expression to match on a tag value
|
||||||
pattern = "^(\\d)\\d\\d$"
|
pattern = "^(\\d)\\d\\d$"
|
||||||
## Pattern for constructing a new value (${1} represents first subgroup)
|
## Matches of the pattern will be replaced with this string. Use ${1}
|
||||||
|
## notation to use the text of the first submatch.
|
||||||
replacement = "${1}xx"
|
replacement = "${1}xx"
|
||||||
|
|
||||||
[[processors.regex.fields]]
|
[[processors.regex.fields]]
|
||||||
|
## Field to change
|
||||||
key = "request"
|
key = "request"
|
||||||
## All the power of the Go regular expressions available here
|
## All the power of the Go regular expressions available here
|
||||||
## For example, named subgroups
|
## For example, named subgroups
|
||||||
|
|
|
@ -27,14 +27,16 @@ const sampleConfig = `
|
||||||
# key = "resp_code"
|
# key = "resp_code"
|
||||||
# ## Regular expression to match on a tag value
|
# ## Regular expression to match on a tag value
|
||||||
# pattern = "^(\\d)\\d\\d$"
|
# pattern = "^(\\d)\\d\\d$"
|
||||||
# ## Pattern for constructing a new value (${1} represents first subgroup)
|
# ## Matches of the pattern will be replaced with this string. Use ${1}
|
||||||
|
# ## notation to use the text of the first submatch.
|
||||||
# replacement = "${1}xx"
|
# replacement = "${1}xx"
|
||||||
|
|
||||||
# [[processors.regex.fields]]
|
# [[processors.regex.fields]]
|
||||||
|
# ## Field to change
|
||||||
# key = "request"
|
# key = "request"
|
||||||
# ## All the power of the Go regular expressions available here
|
# ## All the power of the Go regular expressions available here
|
||||||
# ## For example, named subgroups
|
# ## For example, named subgroups
|
||||||
# pattern = "^/api(?P<method>/[\\w/]+)\\S*"
|
# pattern = "^/api(?P<method>/[\\w/]+)\\S*"
|
||||||
# replacement = "${method}"
|
# replacement = "${method}"
|
||||||
# ## If result_key is present, a new field will be created
|
# ## If result_key is present, a new field will be created
|
||||||
# ## instead of changing existing field
|
# ## instead of changing existing field
|
||||||
|
|
Loading…
Reference in New Issue