Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion reference/fleet/data-streams-ilm-tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ How you apply an ILM policy depends on your use case. Choose a scenario for the

* **[Scenario 1](/reference/fleet/data-streams-scenario1.md)**: You want to apply an ILM policy to all logs or metrics data streams across all namespaces.
* **[Scenario 2](/reference/fleet/data-streams-scenario2.md)**: You want to apply an ILM policy to selected data streams in an integration.
* **[Scenario 3](/reference/fleet/data-streams-scenario3.md)**: You want apply an ILM policy for data streams in a selected namespace in an integration.
* **[Scenario 3](/reference/fleet/data-streams-scenario3.md)**: You want to apply an ILM policy for data streams in a selected namespace in an integration.
* **[Scenario 4](/reference/fleet/data-streams-scenario4.md)** (9.1+): You want to apply an ILM policy to all data streams in a custom integration using a `@custom` component template.
59 changes: 59 additions & 0 deletions reference/fleet/data-streams-scenario4.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
navigation_title: Scenario 4
mapped_pages:
- https://www.elastic.co/guide/en/fleet/current/data-streams-scenario4.html
products:
- id: fleet
- id: elastic-agent
---

# Scenario 4: Apply an ILM policy to all data streams in a custom integration [data-streams-scenario4]

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.

:::{note}
This method is available in version 9.1 and later.
:::

## Step 1: Define the ILM policy [data-streams-scenario4-step1]

1. In {{kib}}, go to **Stack Management** and select **Index Lifecycle Policies**. You can also use the [global search field](/get-started/the-stack.md#kibana-navigation-search).
2. Click **Create policy**.
3. Name the policy, configure it as needed, and click **Save policy**.

## Step 2: Create a custom component template [data-streams-scenario4-step2]

Create a custom component template named `<integration>@custom`, replacing `<integration>` with your package name.

For example, for a Docker integration, use:

```json
PUT _component_template/docker@custom
{
"template": {
"settings": {
"index": {
"lifecycle": {
"name": "docker-ilm-policy"
}
}
},
"mappings": {
"properties":
}
}
}
}
```

## Step 3: Deploy or update the integration [data-streams-scenario4-step3]

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 it has been deployed, the ILM policy from `docker@custom` will apply to all data streams in the package.
1 change: 1 addition & 0 deletions reference/fleet/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ toc:
- file: data-streams-scenario1.md
- file: data-streams-scenario2.md
- file: data-streams-scenario3.md
- file: data-streams-scenario4.md
- file: data-streams-pipeline-tutorial.md
- file: data-streams-advanced-features.md
- file: agent-command-reference.md
Expand Down
Loading