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

filebeat/input/{tcp,udp}: use correct address list in udp #35996

Merged
merged 1 commit into from Jul 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Expand Up @@ -143,6 +143,7 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff]
- Fix metric collection in GCPPubSub input. {pull}35773[35773]
- Fix end point deregistration in http_endpoint input. {issue}35899[35899] {pull}35903[35903]
- Fix duplicate ID panic in filestream metrics. {issue}35964[35964] {pull}35972[35972]
- Improve error reporting and fix IPv6 handling of TCP and UDP metric collection. {pull}35996[35996]

*Heartbeat*

Expand Down
3 changes: 3 additions & 0 deletions filebeat/input/tcp/input.go
Expand Up @@ -338,6 +338,9 @@ func procNetTCP(path string, addr []string, hasUnspecified bool, addrIsUnspecifi
if len(addr) == 0 {
return 0, nil
}
if len(addr) != len(addrIsUnspecified) {
return 0, errors.New("mismatched address/unspecified lists: please report this")
}
b, err := os.ReadFile(path)
if err != nil {
return 0, err
Expand Down
7 changes: 5 additions & 2 deletions filebeat/input/udp/input.go
Expand Up @@ -272,7 +272,7 @@ func (m *inputMetrics) poll(addr, addr6 []string, each time.Duration, log *logp.
if err != nil {
log.Warnf("failed to get initial udp stats from /proc: %v", err)
}
rx6, drops6, err := procNetUDP("/proc/net/udp6", addr, hasUnspecified6, addrIsUnspecified6)
rx6, drops6, err := procNetUDP("/proc/net/udp6", addr6, hasUnspecified6, addrIsUnspecified6)
if err != nil {
log.Warnf("failed to get initial udp6 stats from /proc: %v", err)
}
Expand All @@ -288,7 +288,7 @@ func (m *inputMetrics) poll(addr, addr6 []string, each time.Duration, log *logp.
log.Warnf("failed to get udp stats from /proc: %v", err)
continue
}
rx6, drops6, err := procNetUDP("/proc/net/udp6", addr, hasUnspecified6, addrIsUnspecified6)
rx6, drops6, err := procNetUDP("/proc/net/udp6", addr6, hasUnspecified6, addrIsUnspecified6)
if err != nil {
log.Warnf("failed to get udp6 stats from /proc: %v", err)
continue
Expand Down Expand Up @@ -333,6 +333,9 @@ func procNetUDP(path string, addr []string, hasUnspecified bool, addrIsUnspecifi
if len(addr) == 0 {
return 0, 0, nil
}
if len(addr) != len(addrIsUnspecified) {
return 0, 0, errors.New("mismatched address/unspecified lists: please report this")
}
b, err := os.ReadFile(path)
if err != nil {
return 0, 0, err
Expand Down