inputs.netflow
: Inconsistent IP version field in sFlow decoder
#16402
Labels
bug
unexpected problem or unintended behavior
Relevant telegraf.conf
Logs from Telegraf
System info
Telegraf v1.33.1 running on Docker, Debian 12 as base OS
Docker
Steps to reproduce
Steps described in issue #15918 (comment) are valid.
Expected behavior
ip_version
field must always be of typestring
, with valuesIPv4
,IPv6
orunknown
depending ofdecodeSflowIPVersion()
return value. Furthermore, README for netflow input plugin includes some examples of metrics which includes this field as a string value.Actual behavior
There are some inconsistencies with
ip_version
field when using the sFlow decoder for Netflow input plugin. This field can sometimes display values as numeric values (4 or 6) and at other times as text (IPv4 or IPv6).Additional info
In this image you can see the different values that we have received during a period of time:
After some investigation, I have concluded that the problem comes from these lines of code:
telegraf/plugins/inputs/netflow/sflow_v5.go
Line 383 in f8e7aec
telegraf/plugins/inputs/netflow/sflow_v5.go
Line 407 in f8e7aec
As described in other parts of the code, the correct way to include the
ip_version
field is as text, by converting the numeric value using the functiondecodeSflowIPVersion
.I will open a PR with the fix as soon as I can
The text was updated successfully, but these errors were encountered: