diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index 9cff19cc3f1f..f9cd74118f25 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -166,6 +166,7 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff] - Fix a bug in Salesforce input to only handle responses with 200 status code {pull}41015[41015] - Fixed failed job handling and removed false-positive error logs in the GCS input. {pull}41142[41142] - Bump github.com/elastic/go-sfdc dependency used by x-pack/filebeat/input/salesforce. {pull}41192[41192] +- Log bad handshake details when websocket connection fails {pull}41300[41300] *Heartbeat* diff --git a/x-pack/filebeat/input/streaming/websocket.go b/x-pack/filebeat/input/streaming/websocket.go index ce0f086e558b..1deaf8b07fa5 100644 --- a/x-pack/filebeat/input/streaming/websocket.go +++ b/x-pack/filebeat/input/streaming/websocket.go @@ -228,7 +228,11 @@ func connectWebSocket(ctx context.Context, cfg config, url string, log *logp.Log if err == nil { return conn, response, nil } - log.Debugw("attempt %d: webSocket connection failed. retrying...\n", attempt) + if err == websocket.ErrBadHandshake { + log.Errorf("attempt %d: webSocket connection failed with bad handshake (status %d) retrying...\n", attempt, response.StatusCode) + continue + } + log.Debugf("attempt %d: webSocket connection failed. retrying...\n", attempt) waitTime := calculateWaitTime(retryConfig.WaitMin, retryConfig.WaitMax, attempt) time.Sleep(waitTime) }