Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow regexp processor to mix different tags #5863

Merged
merged 1 commit into from
Jun 14, 2019

Conversation

adrianlzt
Copy link
Contributor

This change allows to mix values from different tags.
When regexp is used to transform a tag, if value append is set to
true and we the result_key tag already exists, replacement value
will be appended to the end of the current tag value.

Example use case, set host tag with the values of tags clustername and dcname:
Input:

vsphere_cluster_vmop,clustername=somecluster,dcname=mydc,host=xxxx numPoweron_latest=27i 1557967800000000000

Processor config:

[[processors.regex]]
  [[processors.regex.tags]]
    key = "clustername"
    pattern = "^(.*)"
    replacement = "${1}"
    result_key = "host"
  [[processors.regex.tags]]
    key = "dcname"
    pattern = "^(.*)"
    replacement = "_${1}"
    result_key = "host"
    append = true

Output:

vsphere_cluster_vmop,clustername=somecluster,dcname=mydc,host=somecluster_mydc numPoweron_latest=27i 1557967800000000000

Required for all PRs:

  • Signed CLA.
  • Associated README.md updated.
  • Has appropriate unit tests.

This change allows to mix values from different tags.
When regexp is used to transform a tag, if value `append` is set to
`true` and we the `result_key` tag already exists, replacement value
will be appended to the end of the current tag value.
@glinton glinton added the feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin label May 16, 2019
@danielnelson danielnelson added this to the 1.12.0 milestone Jun 14, 2019
@danielnelson danielnelson merged commit d3af8fd into influxdata:master Jun 14, 2019
bitcharmer pushed a commit to bitcharmer/telegraf that referenced this pull request Oct 18, 2019
athoune pushed a commit to bearstech/telegraf that referenced this pull request Apr 17, 2020
idohalevi pushed a commit to idohalevi/telegraf that referenced this pull request Sep 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants