diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index 8c6a49132d6..84d487df9b0 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -167,6 +167,7 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff] - 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] - Improve modification time handling for entities and entity deletion logic in the Active Directory entityanalytics input. {pull}41179[41179] +- 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 ce0f086e558..1deaf8b07fa 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) }