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

Sidecar renders configuration if Server response is not successfull #413

Closed
HenryTheSir opened this issue Jun 9, 2021 · 0 comments · Fixed by #427
Closed

Sidecar renders configuration if Server response is not successfull #413

HenryTheSir opened this issue Jun 9, 2021 · 0 comments · Fixed by #427
Assignees

Comments

@HenryTheSir
Copy link

HenryTheSir commented Jun 9, 2021

Problem description

If the Server responds with an error/timeout for the configuration call. Sidecar detects this as a 'new' configuration and rewrites the local configuration and restarts the specific agent. In the next iteration it detects the correct configuration again as new configuration and restarts the agent.

Steps to reproduce the problem

  1. Make sure the request for the configuration times out or fails, without an HTTP Status Code or DNS Resolution times out via UDP.

Possible Solution

In this Line the Error gets detected from the sidecar, and the error gets logged to file:

if err != nil && resp == nil {
msg := "Fetching configuration failed"
system.GlobalStatus.Set(backends.StatusError, msg+": "+err.Error())
log.Errorf("[RequestConfiguration] %s: %v", msg, err)
}

As the resp being nil following condition does not match:

if resp != nil {

So the last return statement triggers and returns an 'nil' Error, which leads the calling procedure to 'detect' a new config:

return configurationResponse, nil

Logs

time="2021-05-20T02:39:05+02:00" level=error msg="[RequestConfiguration] Fetching configuration failed: Get GLHOST/api/sidecar/configurations/render/xxxxxxx dial tcp: lookup GLHOST  on IP:Port2 : write udp IP:Port1-> IP:Port2 : write: invalid argument" 
time="2021-05-20T02:39:05+02:00" level=info msg="[filebeat-wrapped] Configuration change detected, rewriting configuration file." 
time="2021-05-20T02:39:06+02:00" level=info msg="[filebeat-wrapped] Stopping" 
time="2021-05-20T02:39:08+02:00" level=info msg="[filebeat-wrapped] Starting (exec driver)" 
time="2021-05-20T02:39:09+02:00" level=error msg="[filebeat-wrapped] Unable to start collector after 3 tries, giving up!" 
time="2021-05-20T02:39:09+02:00" level=error msg="[filebeat-wrapped] Collector output: Exiting: No outputs are defined. Please define one under the output section.\nThu May 20 02:39:08 CEST 2021 /opt/graylog-sidecar/filebeat-sudo-wrapper.sh: started\nThu May 20 02:39:08 CE 
ST 2021 /opt/graylog-sidecar/filebeat-sudo-wrapper.sh: start collector: sudo /opt/filebeat/filebeat -c /opt/graylog-sidecar/generated/filebeat-wrapped.conf -strict.perms=false\n" 
time="2021-05-20T02:39:16+02:00" level=info msg="[filebeat-wrapped] Configuration change detected, rewriting configuration file." 
time="2021-05-20T02:39:17+02:00" level=info msg="[filebeat-wrapped] Starting (exec driver)" ```
### Environment

* Sidecar Version: 1.0.1
* Graylog Version: 4.x
* Operating System: RHEL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants