-
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] Simulate template doesn't always use the right index template #164269
Comments
Pinging @elastic/fleet (Team:Fleet) |
I think this issue is related (the same?) to #160775 |
@juliaElastic Correct, closing. |
Just to clarify, Also, the problem could occur in case a user clones an integration Index Template to customize their behavior per namespace. Example:
Also I think the |
I think this issue is different to #160775. @lucabelluccini is right, if we could use the API to find the origin datastream (and ensure that it is a managed datastream) then this would be better. |
## Summary Resolve #164269 Some context why I picked this up now: #162772 (comment) To verify: - Make sure 8.8+ apm package is installed - Create data stream `PUT _data_stream/metrics-apm.app.default-default` - Reinstall apm package from API or UI - Check kibana info logs, expect to not see simulate template error and rollover like below ``` [2023-09-21T15:54:36.559+02:00][INFO ][plugins.fleet] Mappings update for metrics-apm.app.default-default failed due to ResponseError: illegal_argument_exception Root causes: illegal_argument_exception: unable to simulate template [metrics-apm.app.default] that does not exist [2023-09-21T15:54:36.559+02:00][INFO ][plugins.fleet] Triggering a rollover for metrics-apm.app.default-default ``` ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios
## Summary Resolve elastic#164269 Some context why I picked this up now: elastic#162772 (comment) To verify: - Make sure 8.8+ apm package is installed - Create data stream `PUT _data_stream/metrics-apm.app.default-default` - Reinstall apm package from API or UI - Check kibana info logs, expect to not see simulate template error and rollover like below ``` [2023-09-21T15:54:36.559+02:00][INFO ][plugins.fleet] Mappings update for metrics-apm.app.default-default failed due to ResponseError: illegal_argument_exception Root causes: illegal_argument_exception: unable to simulate template [metrics-apm.app.default] that does not exist [2023-09-21T15:54:36.559+02:00][INFO ][plugins.fleet] Triggering a rollover for metrics-apm.app.default-default ``` ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios (cherry picked from commit 3ff82f2)
…7008) # Backport This will backport the following commits from `main` to `8.10`: - [[Fleet] fix index template from datastream name (#166941)](#166941) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Julia Bardi","email":"90178898+juliaElastic@users.noreply.github.com"},"sourceCommit":{"committedDate":"2023-09-22T08:20:05Z","message":"[Fleet] fix index template from datastream name (#166941)\n\n## Summary\r\n\r\nResolve https://github.com/elastic/kibana/issues/164269\r\n\r\nSome context why I picked this up now:\r\nhttps://github.com//issues/162772#issuecomment-1728031080\r\n\r\nTo verify:\r\n- Make sure 8.8+ apm package is installed\r\n- Create data stream `PUT _data_stream/metrics-apm.app.default-default`\r\n- Reinstall apm package from API or UI\r\n- Check kibana info logs, expect to not see simulate template error and\r\nrollover like below\r\n\r\n```\r\n[2023-09-21T15:54:36.559+02:00][INFO ][plugins.fleet] Mappings update for metrics-apm.app.default-default failed due to ResponseError: illegal_argument_exception\r\n Root causes:\r\n illegal_argument_exception: unable to simulate template [metrics-apm.app.default] that does not exist\r\n[2023-09-21T15:54:36.559+02:00][INFO ][plugins.fleet] Triggering a rollover for metrics-apm.app.default-default\r\n```\r\n\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios","sha":"3ff82f2c17e532fed5d5544ed9bbae4f6e7331af","branchLabelMapping":{"^v8.11.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:Fleet","backport:prev-minor","v8.11.0"],"number":166941,"url":"https://github.com/elastic/kibana/pull/166941","mergeCommit":{"message":"[Fleet] fix index template from datastream name (#166941)\n\n## Summary\r\n\r\nResolve https://github.com/elastic/kibana/issues/164269\r\n\r\nSome context why I picked this up now:\r\nhttps://github.com//issues/162772#issuecomment-1728031080\r\n\r\nTo verify:\r\n- Make sure 8.8+ apm package is installed\r\n- Create data stream `PUT _data_stream/metrics-apm.app.default-default`\r\n- Reinstall apm package from API or UI\r\n- Check kibana info logs, expect to not see simulate template error and\r\nrollover like below\r\n\r\n```\r\n[2023-09-21T15:54:36.559+02:00][INFO ][plugins.fleet] Mappings update for metrics-apm.app.default-default failed due to ResponseError: illegal_argument_exception\r\n Root causes:\r\n illegal_argument_exception: unable to simulate template [metrics-apm.app.default] that does not exist\r\n[2023-09-21T15:54:36.559+02:00][INFO ][plugins.fleet] Triggering a rollover for metrics-apm.app.default-default\r\n```\r\n\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios","sha":"3ff82f2c17e532fed5d5544ed9bbae4f6e7331af"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.11.0","labelRegex":"^v8.11.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/166941","number":166941,"mergeCommit":{"message":"[Fleet] fix index template from datastream name (#166941)\n\n## Summary\r\n\r\nResolve https://github.com/elastic/kibana/issues/164269\r\n\r\nSome context why I picked this up now:\r\nhttps://github.com//issues/162772#issuecomment-1728031080\r\n\r\nTo verify:\r\n- Make sure 8.8+ apm package is installed\r\n- Create data stream `PUT _data_stream/metrics-apm.app.default-default`\r\n- Reinstall apm package from API or UI\r\n- Check kibana info logs, expect to not see simulate template error and\r\nrollover like below\r\n\r\n```\r\n[2023-09-21T15:54:36.559+02:00][INFO ][plugins.fleet] Mappings update for metrics-apm.app.default-default failed due to ResponseError: illegal_argument_exception\r\n Root causes:\r\n illegal_argument_exception: unable to simulate template [metrics-apm.app.default] that does not exist\r\n[2023-09-21T15:54:36.559+02:00][INFO ][plugins.fleet] Triggering a rollover for metrics-apm.app.default-default\r\n```\r\n\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios","sha":"3ff82f2c17e532fed5d5544ed9bbae4f6e7331af"}}]}] BACKPORT--> Co-authored-by: Julia Bardi <90178898+juliaElastic@users.noreply.github.com>
Fleet tries to guess the index template name from the data stream name during simulateTemplate see this logic:
kibana/x-pack/plugins/fleet/server/services/epm/elasticsearch/template/template.ts
Lines 537 to 540 in 8532b99
It seems that this logic doesn't work well in all cases, there should be a more robust way to find an index template of a data stream.
Steps to reproduce:
unable to simulate template [metrics-apm.app.event_gateway] that does not exist
metrics-apm.app.event_gateway-<dataset>
is attempted to be simulated as index templatemetrics-apm.app.event_gateway
while the actual index template ismetrics-apm.app
The text was updated successfully, but these errors were encountered: