-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 support for tags and collectors with multiple configurations #13433
Conversation
…#13349) * Add support for multiple configurations per collector This will need a new sidcar release. Old sidecars are still supported with just a single configuration. * Use Java 9 Lists * Add support for ${sidecar.spoolDir} variable * Fix tests * Revert "Add support for multiple configurations per collector" This reverts commit 0a17743. * Use ${sidecar.spoolDir} for fresh collector templates And add explanation to the UI * make eslint happy * convert tags to Set and fix Autovalue * Support configuration_id in CollectorStatus Co-authored-by: Othello Maurer <[email protected]>
* add assignedFromTags property to assignment * Don't fail for unknown properties on NodeDetails This makes it easier to extend the sidecar in the future * Create sidecar config assignments based on tags This is a first naive approach. Every registration request will rebuild the assignments and this is probably too expensive. * fix test * Fix more Tests * Fine grained EtagService Use three different caches for configs, collectors and assignments. * Add Etag caching for UpdateRegistration results The response to the registration PUT request contains configuration assignments, which can be cached as well. This requires us to invalidate the sidecar etag cache in more situations: - Configration assignments - User triggered collector actions (stop, start, restart) * Cleanup old assignment caching commit * optimize * fix after merge * replace deprecated notempty annotation * cache assignments per sidecar id using just the md5 of an assignment result might leed to sidecars missing out on updates. An assignment is always meant for a single sidecar, caching the entire assignment over all sidecars is wrong. A per sidecar cache entry allows more fine grained cache invalidations. Bump the cacheMaxSize to 5000 entries, which is a more meaningful number, considered that this might have to hold all sidecars. * Refactor sidecar register() call. Only update the tagged assignments when we miss the cache. * change cache naming * more refactoring * improve cache invalidation * use fancy java Co-authored-by: Othello Maurer <[email protected]> * Add more cases for tag invalidation and fix tests * add tags to Config summary * Generate EntityTags with a better hash algorithm As @thll noticed, Object.hashCode() is prone to having collisions * Handle manual assignments via API * rename * Make tags available as config variables. This allows configs to be written with conditionals. E.g.: ``` <#if sidecar.tags.apache??> - /var/log/apache/*.log </#if> ``` * dont lose tags on UI configuration updates Co-authored-by: Othello Maurer <[email protected]>
* Only assign tagged configs that match the OS * rename test * add tests for SidecarService.updateTaggedConfigurationAssignments() * add tests for SidecarService.applyManualAssignments()
* Fix cache invalidation for collector actions The registration cache was using the sidecar "_id", while the ActionService was invalidating the sidecar "node_id". Change the entire cache to using the "node_id" * Rename parameter from sidecarId to sidecarNodeId Co-authored-by: Othello Maurer <[email protected]>
* Invalidate registration cache only for affected sidecars * Use node-id for cache invalidation The cache key has been changed since this PR has been started. * Consider OS for cache invalidation Also use symmetric difference of tags to further reduce unnecessary invalidations * Invalidate less when creating new configs
99bd9c2
to
4555f99
Compare
…#13349) * Add support for multiple configurations per collector This will need a new sidcar release. Old sidecars are still supported with just a single configuration. * Use Java 9 Lists * Add support for ${sidecar.spoolDir} variable * Fix tests * Revert "Add support for multiple configurations per collector" This reverts commit 0a17743. * Use ${sidecar.spoolDir} for fresh collector templates And add explanation to the UI * make eslint happy * convert tags to Set and fix Autovalue * Support configuration_id in CollectorStatus Co-authored-by: Othello Maurer <[email protected]>
* add assignedFromTags property to assignment * Don't fail for unknown properties on NodeDetails This makes it easier to extend the sidecar in the future * Create sidecar config assignments based on tags This is a first naive approach. Every registration request will rebuild the assignments and this is probably too expensive. * fix test * Fix more Tests * Fine grained EtagService Use three different caches for configs, collectors and assignments. * Add Etag caching for UpdateRegistration results The response to the registration PUT request contains configuration assignments, which can be cached as well. This requires us to invalidate the sidecar etag cache in more situations: - Configration assignments - User triggered collector actions (stop, start, restart) * Cleanup old assignment caching commit * optimize * fix after merge * replace deprecated notempty annotation * cache assignments per sidecar id using just the md5 of an assignment result might leed to sidecars missing out on updates. An assignment is always meant for a single sidecar, caching the entire assignment over all sidecars is wrong. A per sidecar cache entry allows more fine grained cache invalidations. Bump the cacheMaxSize to 5000 entries, which is a more meaningful number, considered that this might have to hold all sidecars. * Refactor sidecar register() call. Only update the tagged assignments when we miss the cache. * change cache naming * more refactoring * improve cache invalidation * use fancy java Co-authored-by: Othello Maurer <[email protected]> * Add more cases for tag invalidation and fix tests * add tags to Config summary * Generate EntityTags with a better hash algorithm As @thll noticed, Object.hashCode() is prone to having collisions * Handle manual assignments via API * rename * Make tags available as config variables. This allows configs to be written with conditionals. E.g.: ``` <#if sidecar.tags.apache??> - /var/log/apache/*.log </#if> ``` * dont lose tags on UI configuration updates Co-authored-by: Othello Maurer <[email protected]>
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.
I have some small changes. Other than that we are good to go 👍
graylog2-web-interface/src/components/sidecars/administration/CollectorsAdministration.css
Outdated
Show resolved
Hide resolved
graylog2-web-interface/src/components/sidecars/common/ColorLabel.tsx
Outdated
Show resolved
Hide resolved
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.
Looks good to me !
We still have some java code in this PR if that part is already merged we should consider rebasing so that the only the frontend code is in this PR.
Thank you !
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.
LGTM
Hey guys, great to see this issue is merged; when can we expect an update for the graylog-sidecar binaries ? days ? weeks? thanks ! |
@gael-donat we are planning to release a 5.0 beta / Sidecar 1.3 beta next week. |
Ok thanks. Since the LDAP group mapping is not a free feature anymore, we still are on graylog3. I assume the configuration will not be available if we stay on graylog3 ? |
Yeah, sorry. that's not gonna happen. We are not even actively maintaining 3.x anymore. (Patching Log4Shell was an exception) |
that's understandable. Shame we lost the tag feature switch from collector to sidecar tho.. but great to see it added again. |
Description
This PR adds two features to the Sidecar:
Both features need Sidecar 1.3.x or later.
Older sidecars are still supported, but will only pick up the first assigned configuration.
For implementation details see https://github.com/Graylog2/graylog-plugin-enterprise/issues/3956
To improve the UX of Sidecars Configurations Assignment and Tags in this PR we:
Fixes https://github.com/Graylog2/graylog-plugin-enterprise/issues/3956
Fixes #10454