Skip to content

Commit

Permalink
Log EOFs found on Kubernetes watcher at debug level (elastic#10988)
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.
  • Loading branch information
jsoriano authored Mar 5, 2019
1 parent bcaf5e9 commit 50ab684
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 @@ -135,6 +135,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Allow to configure Kafka fetching strategy for the topic metadata. {pull}10682[10682]
- Using an environment variable for the password when enrolling a beat will now raise an error if the variable doesn't exist. {pull}10936[10936]
- Add missing `host.containerized` and `host.os.build` to fields.ecs.yml. {pull}11016[11016]
- Reconnections of Kubernetes watchers are now logged at debug level when they are harmless. {pull}10988[10988]

*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 50ab684

Please sign in to comment.