-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Add registry to Filebeat's diagnostic #41795
Add registry to Filebeat's diagnostic #41795
Conversation
This pull request does not have a backport label.
To fixup this pull request, you need to add the backport labels for the needed
|
|
…try-on-diagnostics
…try-on-diagnostics
Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane) |
|
I'll implement those changes. |
The Fleet server upload API used to get diagnostics as an action probably has a limit, I'm not sure what it is by default off the top of my head. I would expect it is ~100 MB so if we go with 20 MB we need to make sure we don't push ourselves past that in real use cases. The few compressed gzipped diagnostics I have laying around are all <5 MB now for reference. |
The Fleet settings aren't super clear on what the upload file size limit is, maybe there isn't one? The files are chunked as part of the implementation. https://github.com/elastic/fleet-server/blob/4132a505f0c759e332a890fdf701b8ff238cf91a/fleet-server.reference.yml#L200-L214 |
…try-on-diagnostics
…try-on-diagnostics
…try-on-diagnostics
…try-on-diagnostics
All review comments have been addressed. The failure from TestRegistryIsInDiagnostics has been fixed |
Did you test this with a real agent uploading diagnostics that include the registry to Fleet? If not, can you? I want to make sure this actually works end to end before merging it. |
Yes, I have tested it end-to-end multiple times and even demoed it after the On-Week. The only thing I haven't manually tested is the limit when the registry is too large. I can try testing this at some before merging. |
This commit moves the code that populates `registryFileRegExps` from a `init()` function to a place before `matchRegistyFiles` is called. Because generating diagnostics is very sporadic, there is not meaningful performance change between having it generated once on `init()` or generating it every time it's needed.
This commit adds a test for when Filebat's registry is empty, that's done by using the benchmark input. The benchmark input is fixed so it can run under Elastic-Agent.
This commit adds Filebeat's registry folder to the Elastic-Agent diagnostics. It's called `registry.tar.gz` and includes all registry files on `${path.home}/registry`. The registry is first archived into a temporary tar file. The temporary file is created by calling `os.CreateTemp` and will use the OS's temporary folder. Then it's gziped in memory and returned to Elastic-Agent, finally the temporary file is removed from the disk. If the final gziped file is more than 20mb, it is skipped due to its large size. (cherry picked from commit 572cb0e)
This commit adds Filebeat's registry folder to the Elastic-Agent diagnostics. It's called `registry.tar.gz` and includes all registry files on `${path.home}/registry`. The registry is first archived into a temporary tar file. The temporary file is created by calling `os.CreateTemp` and will use the OS's temporary folder. Then it's gziped in memory and returned to Elastic-Agent, finally the temporary file is removed from the disk. If the final gziped file is more than 20mb, it is skipped due to its large size. (cherry picked from commit 572cb0e) Co-authored-by: Tiago Queiroz <[email protected]>
Proposed commit message
This commit adds Filebeat's registry folder to the Elastic-Agent
diagnostics. It's called
registry.tar.gz
and includes all registry fileson
${path.home}/registry
.The registry is first archived into a temporary tar file. The
temporary file is created by calling
os.CreateTemp
and will use theOS's temporary folder. Then it's gziped in memory and returned to
Elastic-Agent, finally the temporary file is removed from the disk.
If the final gziped file is more than 20mb, it is skipped due to its large
size.
Checklist
[ ] I have made corresponding changes to the documentation[ ] I have made corresponding change to the default configuration filesCHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.Disruptive User Impact
None.
Author's Checklist
How to test this PR locally
The easiest way to test it locally is to package the Elastic-Agent with your local build of Beats by setting
EXTERNAL=false
when callingmage build
in the Elastic-Agent folder.Then, deploy the Elastic-Agent, let it ingest some logs and request the diagnostics. Extract the diagnostics and look for
registry.tar.gz
incomponents/filestram-*
folders.You can also run the integration tests:
Related issues
## Use cases## ScreenshotsLogs
Full log entries
Only the
message
field: