You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#`order` as a string. Expectation: Either an error is thrown or the string is converted to an int when parsing the config. Neither happens. #Keep in mind processors don't work as documented. In this example, `order` isn't being set, so the second processor runs before the first. Additional examples in the 'steps to reproduce' demonstrate that
[agent]
interval = "10s"omit_hostname = true
[[outputs.file]]
files = ["stdout"]
[[inputs.mem]]
taginclude = []
fieldpass = ["total"]
[[processors.rename]]
order = "1"
[[processors.rename.replace]]
field = "total"dest = "total_renamed_once"
[[processors.rename]]
order = "2"
[[processors.rename.replace]]
field = "total_renamed_once"dest = "total_renamed_twice"
Logs from Telegraf
See steps to reproduce for more examples. This is the log from the final example with a string-quoted `order` showing no error message, even with debug logging
telegraf --config ./telegraf.conf --test --debug
2023-03-15T15:31:25Z I! Starting Telegraf 1.25.1
2023-03-15T15:31:25Z I! Available plugins: 213 inputs, 9 aggregators, 26 processors, 21 parsers, 57 outputs, 2 secret-stores
2023-03-15T15:31:25Z I! Loaded inputs: mem
2023-03-15T15:31:25Z I! Loaded aggregators:
2023-03-15T15:31:25Z I! Loaded processors: rename (2x)
2023-03-15T15:31:25Z I! Loaded secretstores:
2023-03-15T15:31:25Z W! Outputs are not used in testing mode!
2023-03-15T15:31:25Z I! Tags enabled:
2023-03-15T15:31:25Z D! [agent] Initializing plugins
2023-03-15T15:31:25Z D! [agent] Starting service inputs
2023-03-15T15:31:25Z D! [agent] Stopping service inputs
2023-03-15T15:31:25Z D! [agent] Input channel closed
2023-03-15T15:31:25Z D! [agent] Processor channel closed
2023-03-15T15:31:25Z D! [agent] Processor channel closed
2023-03-15T15:31:25Z D! [agent] Stopped Successfully
> mem total_renamed_once=17179869184i 1678894286000000000
System info
Telegraf 1.25.1
Docker
No response
Steps to reproduce
cat << EOF > ./telegraf.conf
#No explicit `order`, with processors defined in order in file: Doesn't work as documented.
# Second processor didn't do its work because it was run before the first processor
[agent]
interval = "10s"
omit_hostname = true
[[outputs.file]]
files = ["stdout"]
[[inputs.mem]]
taginclude = []
fieldpass = ["total"]
[[processors.rename]]
[[processors.rename.replace]]
field = "total"
dest = "total_renamed_once"
[[processors.rename]]
[[processors.rename.replace]]
field = "total_renamed_once"
dest = "total_renamed_twice"
EOF
telegraf --config ./telegraf.conf --test
[...]
> mem total_renamed_once=17179869184i 1678893634000000000
cat << EOF > ./telegraf.conf
#No explicit `order`, with processors defined in reveres in file: Does not work as documented.
# Both processors run - second before the first
[agent]
interval = "10s"
omit_hostname = true
[[outputs.file]]
files = ["stdout"]
[[inputs.mem]]
taginclude = []
fieldpass = ["total"]
[[processors.rename]]
[[processors.rename.replace]]
field = "total_renamed_once"
dest = "total_renamed_twice"
[[processors.rename]]
[[processors.rename.replace]]
field = "total"
dest = "total_renamed_once"
EOF
telegraf --config ./telegraf.conf --test
[...]
> mem total_renamed_twice=17179869184i 1678893654000000000
cat << EOF > ./telegraf.conf
#`order` as an int: works as documented
[agent]
interval = "10s"
omit_hostname = true
[[outputs.file]]
files = ["stdout"]
[[inputs.mem]]
taginclude = []
fieldpass = ["total"]
[[processors.rename]]
order = 1
[[processors.rename.replace]]
field = "total"
dest = "total_renamed_once"
[[processors.rename]]
order = 2
[[processors.rename.replace]]
field = "total_renamed_once"
dest = "total_renamed_twice"
EOF
telegraf --config ./telegraf.conf --test
[...]
> mem total_renamed_twice=17179869184i 1678893671000000000
cat << EOF > ./telegraf.conf
#`order` as a string. Expectation: Either an error is thrown or the string is converted to
# an int when parsing the config. Neither happens. Keep in mind processors don't work
# as documented. In this example, `order` isn't being set, so the SECOND processor (with
# `order="2"`) runs BEFORE the FIRST processor (with `order="1"`)
[agent]
interval = "10s"
omit_hostname = true
[[outputs.file]]
files = ["stdout"]
[[inputs.mem]]
taginclude = []
fieldpass = ["total"]
[[processors.rename]]
order = "1"
[[processors.rename.replace]]
field = "total"
dest = "total_renamed_once"
[[processors.rename]]
order = "2"
[[processors.rename.replace]]
field = "total_renamed_once"
dest = "total_renamed_twice"
EOF
telegraf --config ./telegraf.conf --test
[...]
> mem total_renamed_once=17179869184i 1678893686000000000
Expected behavior
When order is defined in a processor, and config parsing cannot set a value, log an error. Maybe also attempt to first convert str to int before logging an error -- Either accept both str and int values, or log when the value isn't an int.
When order isn't defined, processors should run as ordered in the config file (per documentation )
Actual behavior
When order is defined as a string, the config parser silently fails, no value is set, and no error is logged.
When order isn't defined, Processors run in reverse order
Relevant telegraf.conf
Logs from Telegraf
System info
Telegraf 1.25.1
Docker
No response
Steps to reproduce
Expected behavior
When
order
is defined in a processor, and config parsing cannot set a value, log an error. Maybe also attempt to first convert str to int before logging an error -- Either accept both str and int values, or log when the value isn't an int.When
order
isn't defined, processors should run as ordered in the config file (per documentation )Actual behavior
When
order
is defined as a string, the config parser silently fails, no value is set, and no error is logged.When
order
isn't defined, Processors run in reverse orderAdditional info
May be relevant:
The text was updated successfully, but these errors were encountered: