Scenario 4: Apply an ILM policy to all data streams in a custom integration
Stack Serverless
If you’ve created a custom integration package, you can apply a single ILM policy to all its data streams using a shared @custom
component template. This eliminates the need to configure each data stream individually.
- In Kibana, go to Stack Management and select Index Lifecycle Policies. You can also use the global search field.
- Click Create policy.
- Name the policy, configure it as needed, and click Save policy.
Create a custom component template named <integration>@custom
, replacing <integration>
with your package name.
For example, for a Docker integration, use:
PUT _component_template/docker@custom
{
"template": {
"settings": {
"index": {
"lifecycle": {
"name": "docker-ilm-policy"
}
}
},
"mappings": {
"properties":
}
}
}
}
The @custom
component template is automatically included when the package is installed or updated.
To apply the ILM policy:
Bump the version of your custom package.
Reinstall or upgrade the package using the Fleet UI or Developer Console.
After the ILM policy from docker
has been deployed, it applies to all data streams in the package.