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

multuple instance of processors.strings.replace not working as expected #5843

Closed
ajaywazir opened this issue May 12, 2019 · 2 comments
Closed
Assignees
Labels
bug unexpected problem or unintended behavior

Comments

@ajaywazir
Copy link

Relevant telegraf.conf:

[[processors.strings]]  
order = 102 
   [[processors.strings.replace]]
   tag = "SenderId"
   old = "IPC_123456_01"
   new = "SITE01"
   dest = "site_id"  
    
   [[processors.strings.replace]]
   tag = "SenderId"
   old = "IPC_812345_01"
   new = "SITE02"
   dest = "site_id" 

System info:

1.10.1

Steps to reproduce:

The telgraf uses infux output to store data.
In above situation, only the second tag value is replaced, not the first one.

Expected behavior:

Both tag values should be converted to SITE01 and SITE02 respectively.

Actual behavior:

Only IPC_123456_01 is converter to SITE02 is stored

Additional info:

@glinton glinton self-assigned this May 13, 2019
@glinton glinton added the bug unexpected problem or unintended behavior label May 13, 2019
@glinton
Copy link
Contributor

glinton commented May 15, 2019

I believe the enum processor is a better fit for what you are trying to do. You can use a build from the recent patch and something like the following config:

  [[processors.enum]]
    [[processors.enum.mapping]]
      tag = "SenderId"
      dest = "site_id"
      [processors.enum.mapping.value_mappings]
        "IPC_123456_01" = "SITE01"
        "IPC_812345_01" = "SITE02"

@danielnelson
Copy link
Contributor

This is working as intended, the replacement is unconditional, use the enum processor as suggested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants