-
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] Use default component templates from Elasticsearch #163731
Changes from all commits
751ffa9
c3b1e99
da4b3e3
5e42adb
df4b182
4e2e3bb
b3b0064
d324d59
180bf1e
b399b5a
c6a2c54
129635a
fbbfa91
d84da6f
f32dbe8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
import { errors } from '@elastic/elasticsearch'; | ||
import type { MappingTypeMapping } from '@elastic/elasticsearch/lib/api/types'; | ||
import type { ElasticsearchClient, Logger } from '@kbn/core/server'; | ||
import { STACK_COMPONENT_TEMPLATE_LOGS_SETTINGS } from '@kbn/fleet-plugin/server/constants'; | ||
import { | ||
BENCHMARK_SCORE_INDEX_DEFAULT_NS, | ||
BENCHMARK_SCORE_INDEX_PATTERN, | ||
|
@@ -24,6 +25,10 @@ import { CloudSecurityPostureConfig } from '../config'; | |
interface IndexTemplateSettings { | ||
index: { | ||
default_pipeline: string; | ||
codec?: string; | ||
mapping?: { | ||
ignore_malformed: boolean; | ||
}; | ||
}; | ||
lifecycle?: { name: string }; | ||
} | ||
|
@@ -226,6 +231,10 @@ const updateIndexTemplate = async ( | |
...template?.settings, // nothing inside | ||
index: { | ||
default_pipeline: latestFindingsPipelineIngestConfig.id, | ||
codec: 'best_compression', | ||
mapping: { | ||
ignore_malformed: true, | ||
}, | ||
}, | ||
lifecycle: { name: '' }, | ||
}; | ||
|
@@ -242,7 +251,7 @@ const updateIndexTemplate = async ( | |
aliases: template?.aliases, | ||
}, | ||
_meta, | ||
composed_of: composedOf, | ||
composed_of: composedOf.filter((ct) => ct !== STACK_COMPONENT_TEMPLATE_LOGS_SETTINGS), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @elastic/kibana-cloud-security-posture Not basing the CSP transform index on the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I do think we should remove this special initialization of the transform and index template and use the dedicated feature provided by Fleet for setting up transforms which would not have this issue. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @joshdover, you right, we have task for that: |
||
}); | ||
|
||
logger.info(`Updated index template successfully [Name: ${indexTemplateName}]`); | ||
|
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.
@joshdover, what those 2 new attributes are using for?
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.
These attributes were already being supplied previously by Fleet in the index template you were copying. With this PR, they're not longer added directly to the index template and instead are sourced from the
logs@settings
component template.Since I'm filtering that component template out as mentioned above, I added these settings back explicitly to ensure that this index gets the same settings as it did before this change. I'll leave it to your team to decide if you need these settings or not, but they generally should help reduce storage costs and not drop any data.