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

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

Merged
merged 1 commit into from
Mar 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions plugins/inputs/netflow/netflow_decoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -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] {
Expand Down
Loading