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
Use any input plugin. Try to strip off the last character
Expected behavior:
In the above configuration, I would expect that ServerName should be a tag that holds the value of the tag "ComputerName" without the trailing a or b.
Actual behavior:
Only the the configuration of the last regex is honored. I believe what is happening is that when a subsequent regex match fails, it returns an empty string, which then get's reassigned to the tag, overwriting the value that I was interested in.
Additional info:
I believe this could be a quick fix to the regex processor plugin. The fix I made is below, and seems to be working:
for _, converter := range r.Tags {
if value, ok := metric.GetTag(converter.Key); ok {
k, v := r.convert(converter, value)
if k != "" && v != "" {
metric.AddTag(k, v)
}
}
}
for _, converter := range r.Fields {
if value, ok := metric.GetField(converter.Key); ok {
switch value := value.(type) {
case string:
k, v := r.convert(converter, value)
if k != "" && v != "" {
metric.AddField(r.convert(converter, value))
}
}
}
}
The text was updated successfully, but these errors were encountered:
Relevant telegraf.conf:
System info:
Telegraf Version: 1.8.0
OS: Windows Server 2012
Steps to reproduce:
Expected behavior:
In the above configuration, I would expect that ServerName should be a tag that holds the value of the tag "ComputerName" without the trailing a or b.
Actual behavior:
Only the the configuration of the last regex is honored. I believe what is happening is that when a subsequent regex match fails, it returns an empty string, which then get's reassigned to the tag, overwriting the value that I was interested in.
Additional info:
I believe this could be a quick fix to the regex processor plugin. The fix I made is below, and seems to be working:
The text was updated successfully, but these errors were encountered: