fix(inputs.netflow): Fallback to IPFIX mappings for Netflow v9 (#14910)

This commit is contained in:
Sven Rebhan 2024-03-04 17:41:01 +01:00 committed by GitHub
parent 8e1d1ec4f0
commit 563eae9627
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 15 additions and 0 deletions

View File

@ -706,6 +706,21 @@ func (d *netflowDecoder) decodeValueV9(field netflow.DataField) ([]telegraf.Fiel
return fields, nil
}
// Fallback to IPFIX mappings as some devices seem to send IPFIX elements in
// Netflow v9 packets. See https://github.com/influxdata/telegraf/issues/14902
// and https://github.com/influxdata/telegraf/issues/14903.
if mappings, found := fieldMappingsIPFIX[elementID]; found {
var fields []telegraf.Field
for _, m := range mappings {
v, err := m.decoder(raw)
if err != nil {
return nil, err
}
fields = append(fields, telegraf.Field{Key: m.name, Value: v})
}
return fields, nil
}
// Return the raw data if no mapping was found
key := fmt.Sprintf("type_%d", elementID)
if !d.logged[key] {