-
Notifications
You must be signed in to change notification settings - Fork 148
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
V2 agent diagnostics action #1631
V2 agent diagnostics action #1631
Conversation
Add a diagnostics action handler to the agent. This will allow a user to collect a diagnostics bundle from the fleet-ui. Change log collection from being done in the cmd/diagnostics.go file to dynamically generated hooks. Change the control server from accepting a list of hooks to a varadic list of callback functions that return hooks. This is to allow the agent to dynamically generate a hook for each log (and service log file) when the diagnostics action is triggered from an action or the command line. Add a ZipArchive function to the diagnostics package that will write the zip to the passed writer so that the archive can be created by a command line invokation or from an action.
Change the Hook function from returning a []byte to a []byte, time.Time so that the file mod times collected through diagnostics hooks can be returned from the same filesystem interaction. Add the start of a specific retrier for the fleetapi/uploader that will resend requests if a 429 is recieved.
This pull request is now in conflicts. Could you fix it? 🙏
|
File upload PR is being worked on here: elastic/fleet-server#1902 cc @pzl |
💔 Build Failed
Expand to view the summary
Build stats
Steps errorsExpand to view the steps failures
|
@michel-laterman Can we make sure to add the diagnostics file ID to the ActionResult data that is sent back on ack and saved to Something like this would be great:
|
Err: diag.Err, | ||
Results: files, | ||
}) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This whole code block looks to be a duplicate of what is in the control server code. We should place this code in a common place instead of copying it.
This pull request is now in conflicts. Could you fix it? 🙏
|
What does this PR do?
Add a diagnostics action type and handler to the agent.
The diagnostics action will upload the resulting archive to fleet-server using the new file-upload API (added as a part of the fleetapi module)
Move the archive (zip) assembly from cmd/diagnostics.go into the diagnostics module so that running diagnostics as a command and as an action will produce the same binary.
Changed diagnostics hooks and providers; providers now provide a callback function that can be used to dynamically generate a list of hooks. This was done so that log collection can be provided as hooks when the control server receives the request.
Changed the hook function to return
[]byte, time.Time
so that file mod times can be provided when reading logs.Why is it important?
In order to make it easier for customers to debug deployments we are adding the ability to gather diagnostics bundles in the fleet UI in Kibana.
Checklist
CHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.Author's Checklist
How to test this PR locally
Related issues
Use cases
Screenshots
Logs