Skip to content

Commit

Permalink
x-pack/filebeat/input/websocket: log websocket bad handshake details (#…
Browse files Browse the repository at this point in the history
…41300)

Manual cherrypick.

(cherry picked from commit 0c2f9e7)
  • Loading branch information
efd6 committed Oct 22, 2024
1 parent f8bd07d commit 54d7fa1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff]
- [threatintel] MISP splitting fix for empty responses {issue}38739[38739] {pull}38917[38917]
- Prevent GCP Pub/Sub input blockage by increasing default value of `max_outstanding_messages` {issue}35029[35029] {pull}38985[38985]
- Updated Websocket input title to align with existing inputs {pull}39006[39006]
- Log bad handshake details when websocket connection fails {pull}41300[41300]

*Heartbeat*

Expand Down
3 changes: 3 additions & 0 deletions x-pack/filebeat/input/websocket/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ func (i input) run(env v2.Context, src *source, cursor map[string]interface{}, p
resp.Body.Close()
}
if err != nil {
if err == websocket.ErrBadHandshake {

Check failure on line 116 in x-pack/filebeat/input/websocket/input.go

View workflow job for this annotation

GitHub Actions / lint (windows)

comparing with == will fail on wrapped errors. Use errors.Is to check for a specific error (errorlint)
log.Errorw("websocket connection failed with bad handshake", "status", resp.StatusCode)
}
metrics.errorsTotal.Inc()
log.Errorw("failed to establish websocket connection", "error", err)
return err
Expand Down

0 comments on commit 54d7fa1

Please sign in to comment.