Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Abort request on missing Graylog server version #482

Merged
merged 2 commits into from
Oct 16, 2023
Merged

Abort request on missing Graylog server version #482

merged 2 commits into from
Oct 16, 2023

Conversation

mpfz0r
Copy link
Contributor

@mpfz0r mpfz0r commented Oct 13, 2023

If we fail to read the server version from Graylog, stop using a fallback to 4.0.0 and retry the request instead.

In scenarios with multiple Graylog nodes behind a load balancer, this can lead to the sidecar temporarly stopping all collectors.

Fixes #481

Notes for Reviewers

  • The commit history must be preserved - please use the rebase-merge or standard merge option instead of squash-merge
  • Sync up with the author before merging

If we fail to read the server version from Graylog,
stop using a fallback to 4.0.0 and retry the request
instead.

In scenarios with multiple Graylog nodes behind a load balancer,
this can lead to the sidecar temporarly stopping all collectors.

Fixes #481
Copy link
Contributor

@thll thll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

One thing I noticed is that if the load balancer returns an error without a JSON body, the sidecar will log errors like this:

ERRO[0081] Error fetching server version invalid character '<' looking for beginning of value
ERRO[0081] [UpdateRegistration] Bad response from Graylog server: 503 Service Temporarily Unavailable

This is for the following response:

curl -v localhost:80/api/
*   Trying 127.0.0.1:80...
* Connected to localhost (127.0.0.1) port 80 (#0)
> GET /api/ HTTP/1.1
> Host: localhost
> User-Agent: curl/8.1.2
> Accept: */*
>
< HTTP/1.1 503 Service Temporarily Unavailable
< Server: nginx
< Date: Fri, 13 Oct 2023 13:04:03 GMT
< Content-Type: text/html
< Content-Length: 190
< Connection: keep-alive
<
<html>
<head><title>503 Service Temporarily Unavailable</title></head>
<body>
<center><h1>503 Service Temporarily Unavailable</h1></center>
<hr><center>nginx</center>
</body>
</html>
* Connection #0 to host localhost left intact

That is something we could improve but we don't have to do it in this PR.

@mpfz0r mpfz0r requested a review from thll October 13, 2023 16:46
Copy link
Contributor

@thll thll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for improving the error handling 👍

@thll thll merged commit 7b98332 into master Oct 16, 2023
3 checks passed
@thll thll deleted the issue-481 branch October 16, 2023 07:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sidecar can temporarly lose config registrations
2 participants