-
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
Setup ignore_malformed in fleet #157184
Setup ignore_malformed in fleet #157184
Conversation
…etting for field @timestamp and setting ignore_malformed:false. fix bug on merging index.mapping
Pinging @elastic/fleet (Team:Fleet) |
🤖 GitHub commentsExpand to view the GitHub comments
Just comment with:
|
I did some testing for this changes:
Here attached the index template generated by the system test both for logs and metrics This index template for logs have the expected changes:
"@timestamp": {
"type": "date",
"ignore_malformed": false
}, while this other index template for metrics has none of those changes |
x-pack/plugins/fleet/server/services/epm/elasticsearch/template/install.ts
Outdated
Show resolved
Hide resolved
A quick note about something that I just noticed. index template for metrics has As discussed with @felixbarny this is ok for now since eventually this will be set by Elasticsearch in the future. |
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.
The test case I added in the other PR should cover this. Once that lands, let's merge upstream here and verify everything's working before we merge.
Code LGTM.
Where is this other PR with the test changes? |
hello @kpollich, |
Seems like the I'll fire up the FTR suite for this PR and debug to see what's going on with the other failures. |
The 400's in the package policy tests look like this {
"statusCode": 400,
"error": "Bad Request",
"message": "illegal_argument_exception\n\tCaused by:\n\t\tillegal_argument_exception: invalid composite mappings for [logs-logs]\n\tRoot causes:\n\t\tillegal_argument_exception: composable template [logs-logs] template after composition with component templates [logs-logs@package, logs-logs@custom, .fleet_globals-1, .fleet_agent_id_verification-1] is invalid"
} Seems like the component template we're generating after this change is failing Elasticsearch's validation. |
Is it possible that this PR depends from a future version of ES. I have tested it manually on Kibana from source and Elasticsearch 8.9.0-SNAPSHOT. |
Testing this manually by installing the custom logs package + creating a policy seems to work as expected, so I'm working on debugging why this fails in FTR. |
I was able to reproduce the issue present in tests
Seems like this might be broken in the manual tests as well but maybe not as obviously. |
@gsantoro - Does the error above look like something that's fixed in 8.9.0 SNAPSHOT for ES? |
The FTR tests are in fact running on es-8.9.0 so maybe there's another issue here. |
Hello @kpollich, from a quick search I can find this PR from a while ago. maybe @felixbarny knows more about this |
Here's all the individual component templates at play here [
{
"name": "logs1-generic@package",
"component_template": {
"template": {
"settings": {
"index": {
"lifecycle": {
"name": "logs"
},
"codec": "best_compression",
"default_pipeline": "logs-generic-2.0.0",
"mapping": {
"total_fields": {
"limit": "10000"
},
"ignore_malformed": "true"
}
}
},
"mappings": {
"properties": {
"input": {
"properties": {
"name": {
"type": "constant_keyword",
"value": "logs"
}
}
}
}
}
},
"_meta": {
"package": {
"name": "integration_to_input"
},
"managed_by": "fleet",
"managed": true
}
}
},
{
"name": "logs1-generic@custom",
"component_template": {
"template": {
"settings": {}
},
"_meta": {
"package": {
"name": "integration_to_input"
},
"managed_by": "fleet",
"managed": true
}
}
},
{
"name": ".fleet_globals-1",
"component_template": {
"template": {
"settings": {},
"mappings": {
"_meta": {
"managed_by": "fleet",
"managed": true
},
"dynamic_templates": [
{
"strings_as_keyword": {
"mapping": {
"ignore_above": 1024,
"type": "keyword"
},
"match_mapping_type": "string"
}
}
],
"date_detection": false
}
},
"_meta": {
"managed_by": "fleet",
"managed": true
}
}
},
{
"name": ".fleet_agent_id_verification-1",
"component_template": {
"template": {
"settings": {
"index": {
"final_pipeline": ".fleet_final_pipeline-1"
}
},
"mappings": {
"properties": {
"event": {
"properties": {
"agent_id_status": {
"ignore_above": 1024,
"type": "keyword"
},
"ingested": {
"format": "strict_date_time_no_millis||strict_date_optional_time||epoch_millis",
"type": "date"
}
}
}
}
}
},
"_meta": {
"managed_by": "fleet",
"managed": true
}
}
},
] Seems like the issue might be coming from having EDIT: Removing the |
hey @kpollich about the docs for running the functional tests
Thanks a lot. I'll definitively use this instructions in the future |
@gsantoro didn't you add that feature? I don't think there's a rush to do that as no logging integrations seems to be using synthetic source by default at the moment. But it seems it would be useful to have down the line. |
Ah we did add this! I must've missed this PR last month - sorry about that elastic/package-spec#498 So yeah I don't really have any concerns here then. Enabling synthetic source on a "default" log data stream will error, but it's better to have it error here then to be silently or unexpectedly broken. If a use case for synthetic source on a logging data stream emerges, a package maintainer can set |
can someone from @elastic/security-solution please take a look at this PR? |
Having worked with this code and PR a bit more, I'm not sure we can accept this into Fleet as it stands. The key issues here is that I believe the ideal way for this to work would be: when TSDB or synthetic @gsantoro - Do you think you'd be comfortable making that change in this PR with some guidance from the Fleet team? I don't think we should add the default |
@kpollich this PR only sets |
While this is true, this does require some non-obvious knowledge on the integration maintainer's part. I'd prefer not to burden integration maintainers in this way and instead rely on Fleet to always set the right combination of settings to make synthetic source or TSDB work. Eventually, it'd be nice if Elasticsearch did this for us, but I think pushing complexity away from package manifests and closer to Elasticsearch should be our overall intent here. However, I realize this PR has been a bit long running and we might not want to accept this set back here. I'm happy to fix the failing tests here in this PR and move forward with the assumption that |
Hmm it seems like elastic/package-spec#498 only introduces the ability to provide |
Failing test should be fixed in 70f0ef3 - updated the TSDB rollover tests to use a metrics data stream to unblock. Same approach we took to the failing synthetic source tests earlier. |
💚 Build Succeeded
Metrics [docs]Unknown metric groupsESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: cc @gsantoro |
It’s not that synthetic source is fundamentally incompatible with ignore_malformed. Currently, some field types are not supported in that combination but there’s a plan to add support. It seems like a bit too much magic to automatically toggle ignore_malformed based on whether synthetic source is set and to stop doing that once ES supports all field types with ignore_malformed and synthetic source.
Good point. I think we should add support for setting that on a per dataset level. |
You're right that we would have to remove that logic from Fleet once the ES support is further along. Thanks for considering the future here, I didn't have the full picture of ES's long term plan. With that in mind I think our current approach is the right one. This PR is good to merge from my end. Thanks everyone! |
can someone from @elastic/security-solution please take a look at this PR? |
IIUC this introduces silent failures into integration packages. Developers need to be able to catch these. So I have opened elastic/elastic-package#1276 to request a way to detect this. I think package-spec needs to be clarified to explain that We should probably broadcast this change to fleet-contributors as well if that hasn't been done (may have missed it). edit: Having telemetry about the number of unique |
++
I think we should add a
Do you have a suggestion on how to do that broadcast? Is there an existing mail group that we can use?
++ |
## Summary Add default setting `ignore_malformed: true` to all datastream of type `logs`. Since the field `@timestamp` needs to have `ignore_malformed: false` in the mappings, I'm setting this setting automatically even if not defined in the integration. I had to fix a bug that prevented index.mappings to be copied from the default settings into the template settings ### Checklist Delete any items that are not applicable to this PR. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [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 - [ ] Any UI touched in this PR is usable by keyboard only (learn more about [keyboard accessibility](https://webaim.org/techniques/keyboard/)) - [ ] Any UI touched in this PR does not create any new axe failures (run axe in browser: [FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/), [Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US)) - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server)) - [ ] This was checked for [cross-browser compatibility](https://www.elastic.co/support/matrix#matrix_browsers) ### For maintainers - [ ] This was checked for breaking API changes and was [labeled appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) --------- Co-authored-by: kibanamachine <[email protected]> Co-authored-by: Kyle Pollich <[email protected]>
Summary
Add default setting
ignore_malformed: true
to all datastream of typelogs
. Since the field@timestamp
needs to haveignore_malformed: false
in the mappings, I'm setting this setting automatically even if not defined in the integration.I had to fix a bug that prevented index.mappings to be copied from the default settings into the template settings
Checklist
Delete any items that are not applicable to this PR.
For maintainers