Skip to content

[Stack Monitoring] Add @custom component templates to monitoring templates - #167310

Open
herrBez wants to merge 2 commits into
elastic:mainfrom
herrBez:add-custom-templates
Open

herrBez wants to merge 2 commits into
elastic:mainfrom
herrBez:add-custom-templates

Conversation

@herrBez

@herrBez herrBez commented Nov 24, 2026

Copy link
Copy Markdown

Make the composable .monitoring-*-mb index templates extensible through custom component templates, so users can tweak settings (and mapping) without editing the managed templates.

Each template (kibana, es, logstash, beats, ent-search) now composes two optional components:

  • .monitoring-mb@custom, shared by all of them
  • .monitoring--mb@custom, specific to the template

The shared component is listed first so the per-template one takes precedence. Both are listed in
ignore_missing_component_templates, so nothing changes for clusters that do not define them.

The legacy (non -mb) templates are unchanged, since legacy templates do not support composed_of.

Make the composable .monitoring-*-mb index templates extensible
through custom component templates, so users can tweak settings
without editing the managed templates.

Each template (kibana, es, logstash, beats, ent-search) now
composes two optional components:
  - .monitoring-mb@custom, shared by all of them
  - .monitoring-<name>-mb@custom, specific to the template

The shared component is listed first so the per-template one
takes precedence. Both are listed in
ignore_missing_component_templates, so nothing changes for
clusters that do not define them.

The legacy (non -mb) templates are unchanged, since legacy
templates do not support composed_of.
@herrBez herrBez self-assigned this Nov 24, 2026
@herrBez
herrBez requested a review from a team as a code owner November 24, 2026 18:04
@elasticsearchmachine elasticsearchmachine added v9.7.0 needs:triage Requires assignment of a team area label external-contributor Pull request authored by a developer outside the Elasticsearch team labels Nov 24, 2026
"data_stream": {}
}
"data_stream": {},
"composed_of": [

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Severity: P2 (Medium)

Bump STACK_MONITORING_REGISTRY_VERSION so existing clusters get these hooks. All five -mb templates still resolve to the previous version, and the registry only replaces a versioned template when the bundled version is higher. After an upgrade, creating either @custom component will have no effect on clusters that already have the templates installed.

Generated by Libra. React with 👍 or 👎 to give feedback on this comment.

}
"data_stream": {},
"composed_of": [
".monitoring-mb@custom",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Severity: P3 (Low)

Add a monitoring-specific test that resolves the shipped templates with real custom components. The registry tests check that a PUT is sent with the expected version, but would still pass if these hooks were removed or reversed. Verify that a shared customization reaches all five templates, a product-specific customization wins for its product, and the templates still resolve without either component.

Generated by Libra. React with 👍 or 👎 to give feedback on this comment.

Comment on lines +579 to +582
"composed_of": [
".monitoring-mb@custom",
".monitoring-kibana-mb@custom"
],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Severity: P3 (Low)

Document the exact @custom names in the Metricbeat Stack Monitoring guide and say to create them on the monitoring cluster. The hook names differ from the data stream names, and changing a component does not update existing backing indices; operators need both details to apply a customization and know when to expect it.

Generated by Libra. React with 👍 or 👎 to give feedback on this comment.

@pickypg pickypg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with the notes added (and from the AI review).

Comment on lines +3216 to +3223
"composed_of": [
".monitoring-mb@custom",
".monitoring-beats-mb@custom"
],
"ignore_missing_component_templates": [
".monitoring-mb@custom",
".monitoring-beats-mb@custom"
]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if these should be moved to the top under the index_patterns?

Similarly, I wonder if we should bump the xpack.stack.monitoring.template.release.version (if we don't then this won't overwrite existing templates).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external-contributor Pull request authored by a developer outside the Elasticsearch team needs:triage Requires assignment of a team area label v9.7.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants