Skip to content

Commit

Permalink
Log EOFs found on Kubernetes watcher at debug level (#10988) (#11083)
Browse files Browse the repository at this point in the history
EOFs received when watching Kubernetes events can be recovered by
reconnecting, and they don't need to be harmful. So log them at the
debug level.

(cherry picked from commit 50ab684)
  • Loading branch information
jsoriano authored Mar 6, 2019
1 parent d1c536c commit 72a8d52
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ https://github.com/elastic/beats/compare/v7.0.0-beta1...master[Check the HEAD di
- Fix a issue when remote and local configuration didn't match when fetching configuration from Central Management. {issue}10587[10587]
- Fix unauthorized error when loading dashboards by adding username and password into kibana config. {issue}10513[10513] {pull}10675[10675]
- Ensure all beat commands respect configured settings. {pull}10721[10721]
- Reconnections of Kubernetes watchers are now logged at debug level when they are harmless. {pull}10988[10988]
- Add missing host.* fields to fields.yml. {pull}11016[11016]

*Auditbeat*
Expand Down
11 changes: 8 additions & 3 deletions libbeat/common/kubernetes/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,12 +255,17 @@ func (w *watcher) watch() {
r := w.k8sResourceFactory()
eventType, err := watcher.Next(r)
if err != nil {
logp.Err("kubernetes: Watching API error %v", err)
watcher.Close()
if !(err == io.EOF || err == io.ErrUnexpectedEOF) {
switch err {
case io.EOF:
logp.Debug("kubernetes", "EOF while watching API")
case io.ErrUnexpectedEOF:
logp.Info("kubernetes: Unexpected EOF while watching API")
default:
// This is an error event which can be recovered by moving to the latest resource version
logp.Info("kubernetes: Ignoring event, moving to most recent resource version")
logp.Err("kubernetes: Watching API error %v, ignoring event and moving to most recent resource version", err)
w.lastResourceVersion = ""

}
break
}
Expand Down

0 comments on commit 72a8d52

Please sign in to comment.