-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Fleet] Add namespace-specific index and component templates #121118
Comments
Pinging @elastic/fleet (Team:Fleet) |
Synthetics Use CaseAll monitors added in Monitor Management, use data streams to write back results to ES. There is a separate data stream for each monitor type (ICMP, HTTP or TCP), with browser monitors being further split down between the data sets we store (network, screenshot etc.). In addition, the namespace that’s been defined when setting up the monitor (which will be default by default), is appended to the name of the data stream. All monitors configuration is stored as Kibana saved objects, outside of the Fleet integration policy ecosystem. More information on UI Monitor Management and the Synthetics Service: https://docs.google.com/presentation/d/18eT7xgyqJ5TG5srOeHUN8bFrY-5MBZIpp3TIEcTpI5M/edit#slide=id.g1055e0afed4_0_548 As a result, Fleet will have no way of knowing when a new non-default namespace monitor is created. To enable the generation of namespaced component and index templates, Synthetics will require a way to generate the appropriate component and index templates on the fly whenever a non-default namespace monitor is created. If Fleet could expose the logic for creating these templates on its plugin contract, Synthetics could hook into and reuse the logic from this implementation for UI Monitor Management and the Synthetics Service. cc: @joshdover @andrewvc |
Thanks @dominiqueclarke adding a link to the Uptime issue that explains that the need isn't just to create namespaces dynamically, but also to configure custom ILM policies for each elastic/uptime#453. This will require us to setup index and component templates for each namespace so that users can set custom ILM policies. |
Checking in on the status of this. What version do you expect it to be included in? And is there a workaround available? Our specific need is to apply different ILM policies to different sets of agents. Thank you! |
Hi @threatangler-jp 👋, thanks for the question. We do not have a public ETA on this, however we have published documentation on how to do this manually for the exact use case you have here: https://www.elastic.co/guide/en/fleet/8.4/data-streams-ilm-tutorial.html |
Thank you @joshdover. We are on v8.3.3 and this workaround appears to only be available on v8.4. Let me know if I am mistaken on that factor. We will eventually upgrade but upgrading is a heavy lift and so that will take some time. |
@threatangler-jp Looks like we moved the doc from 8.3 to 8.4. It's supported on 8.3 though, here's the 8.3 doc: https://www.elastic.co/guide/en/fleet/8.3/data-streams.html#data-streams-ilm-tutorial |
@joshdover great news! Thank you :) |
In general, I'm excited about this but I'm bit worried that this is too tightly coupled to Fleet. Ideally, these customization extension points should also be available for data streams that aren't managed by Fleet. Maybe we can find a way to integrate this more tightly into Elasticsearch itself. cc @dakrone @jbaiera @eyalkoren This need is getting more important because of the - reroute:
dataset: {{service.name}} Fleet can't know all values of
One of the ways we could do that is to still rely on the We'd need to add placeholders into the component template, though, for example |
I've created an Elasticsearch issue for this: elastic/elasticsearch#97664. I'd like to propose closing this issue in favor of the Elasticsearch issue as I think this feature shouldn't be exclusive to Fleet. More on the reasoning about that in the issue. |
+1 on moving this to Elasticsearch, though we will still need to do work in Fleet to add these additional component template names to our index templates, which is largely the same work as before. |
Oh sorry, yes we can close this one but we still need #149484 |
Fleet and Elastic Agent users need a mechanism to customize how their data is being ingested, mapped, and stored that will be preserved across Stack and integration package upgrades. This issue outlines how we plan to structure index and component templates to support user customizations to Fleet-managed data streams, on a namespace-level of granularity.
Scope
The goal is provide a future-proof naming scheme and template structure that will allow users to add the following customizations to Fleet-managed data streams:
This scheme does not allow customizing:
default_pipelines
setting which is an array of pipelines, it’s likely that this customization scheme would be compatible.Design
Existing scheme (as of 8.2)
The existing scheme that we use in Fleet today installs a single index template for each dataset in a package that matches data streams for all namespaces. It has the following properties:
<type>-<dataset>
<type>-<dataset>-*
.fleet_agent_id_verification-1
.fleet_globals-1
event.ingested
)<type>-<dataset>@custom
<type>-<dataset>@package
New proposed scheme
In order to preserve user customizations across upgrades, it’s important that we store their overrides in a separate component template that Fleet can copy over to new versions of the package’s index template. In this updated scheme, we will add an additional index template that is namespace-specific and of higher priority than the base template:
<type>-<dataset>-<namespace>
<type>-<dataset>-<namespace>
.fleet_agent_id_verification-1
.fleet_globals-1
event.ingested
)<type>-<dataset>-<namespace>@custom
<type>-<dataset>@custom
<type>-<dataset>@package
During package upgrades, Fleet would preserve the contents of both the ‘global’ custom template (
<type>-<dataset>@custom
) and the namespace-specific ones (<type>-<dataset>-<namespace>@custom
) while replacing all of the other templates (including the index template). This would allow the user’s customizations to be preserved and to override any package-specific settings and mappings.Like the ‘global’ custom template we offer today, we would allow users to directly edit the namespace-specific templates with arbitrary settings and mappings in order to override those supplied by the package. We would also use the template to store customizations that we plan to support directly in the UI (eg. setting the ILM policy).
We will not remove the base index template we install today that matches a wildcard namespace (
<type>-<dataset>-*
) because Elastic Agent standalone requires this template to be installed.Changing a namespace for an existing integration policy
If a user edits an existing integration policy to point to a new namespace, we can offer them the option to copy over any customizations from the previous namespace’s
<type>-<dataset>-<namespace>@custom
template. We would not delete the old templates since this could affect the existing data streams and indices or any standalone agents ingesting data into this namespace.As a separate enhancement, we could offer a ‘cleanup’ UI either in Fleet or Stack Management that shows index templates that are not currently in use.
Customize API
In order to facilitate automated usage of this scheme, we should provide a high-level package customization Kibana Fleet API in Kibana that allows admins to make customizations without worrying about the low-level details of how the templates are configured, whether or not a data stream needs to be rolled over, or how to apply the setting changes retroactively to backing indices. The main usecase for this is for standalone Agent usage. This may also be used to power in-app features for making customizations (eg. setting the ILM policy).
All of the other APIs should also create these namespaces automatically. For example, if an integration policy is added for the
nginx
package on thebar
namespace, thePOST /api/fleet/package_policies
API should also create the appropriate namespace templates if they don't already exist.There are additional use cases for this API outside of index templates, for example there have been other requests for namespace-specific transforms. We should design this API to accommodate future use cases easily.
Upgrade considerations
For packages that were installed before this scheme was introduced, Fleet should automatically add the appropriate namespace-specific index and component templates in order to facilitate a consistent experience for end-users. See #121099
For upgrades where any
@custom
components already exist, they should be retained and not removed so that they are still present once the new package version is installed. This means existing templates should also not get overwritten.Open questions
@custom
component templates for each data stream in an integration package, while the API design proposed here would apply to the entire integration. This can present problems if a user manually edits a single component template so the data streams are not in sync, for example the source of truth is now ambiguous. How would we solve this?@custom
templates unmanaged and never edit them. (@joshdover votes for this one)@custom
templates would then be merged in after settings from this SO. This would allow manual additions and modifications to@custom
templates to be preserved, however deletes would be lost.The text was updated successfully, but these errors were encountered: