From 0fc0a447f53b8a4453a4e0236d7851a06abc408c Mon Sep 17 00:00:00 2001 From: Jaime Soriano Pastor Date: Thu, 28 Feb 2019 15:34:38 +0100 Subject: [PATCH 1/3] Log EOFs found on Kubernetes watcher at debug level 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. --- libbeat/common/kubernetes/watcher.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/libbeat/common/kubernetes/watcher.go b/libbeat/common/kubernetes/watcher.go index 6bcad2f226f..6a8c104f629 100644 --- a/libbeat/common/kubernetes/watcher.go +++ b/libbeat/common/kubernetes/watcher.go @@ -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.Warn("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 } From e7e9b12e3c2be411f4ef311d8ec1857adf5b0b4d Mon Sep 17 00:00:00 2001 From: Jaime Soriano Pastor Date: Mon, 4 Mar 2019 21:27:52 +0100 Subject: [PATCH 2/3] Change warning to info level --- libbeat/common/kubernetes/watcher.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libbeat/common/kubernetes/watcher.go b/libbeat/common/kubernetes/watcher.go index 6a8c104f629..32e2340c820 100644 --- a/libbeat/common/kubernetes/watcher.go +++ b/libbeat/common/kubernetes/watcher.go @@ -260,7 +260,7 @@ func (w *watcher) watch() { case io.EOF: logp.Debug("kubernetes", "EOF while watching API") case io.ErrUnexpectedEOF: - logp.Warn("kubernetes: Unexpected EOF while watching API") + 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.Err("kubernetes: Watching API error %v, ignoring event and moving to most recent resource version", err) From 485d995fc7eeb6a9b5f9d83a33c2b4e7992f58df Mon Sep 17 00:00:00 2001 From: Jaime Soriano Pastor Date: Tue, 5 Mar 2019 12:06:40 +0100 Subject: [PATCH 3/3] Add changelog entry --- CHANGELOG.next.asciidoc | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index a9ee19e8aad..cf78da5d81d 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -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*