Skip to content

Commit f3a9247

Browse files
Update data streams ILM tutorials and associated warnings (#1623) (#1631)
* Draft: data streams scenarios * Add draft for Scenario 1 * Add draft for Scenario 2 * cleanup, and add warning to best practices page (cherry picked from commit 6230032) Co-authored-by: David Kilfoyle <[email protected]>
1 parent 08d48a8 commit f3a9247

File tree

7 files changed

+282
-23
lines changed

7 files changed

+282
-23
lines changed

docs/en/ingest-management/data-streams.asciidoc

Lines changed: 239 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ For data streams, the index template configures the stream's backing indices as
103103
These templates are loaded when the integration is installed, and are used to configure the integration's data streams.
104104

105105
[discrete]
106+
[[data-streams-index-templates-edit]]
106107
== Edit the {es} index template
107108

108109
WARNING: Custom index mappings may conflict with the mappings defined by the integration
@@ -187,6 +188,8 @@ this pipeline can be used for custom data processing, adding fields, sanitizing
187188

188189
Starting in version 8.12, ingest pipelines can be configured to process events at various levels of customization.
189190

191+
NOTE: If you create a custom index pipeline, Elastic is not responsible for ensuring that it indexes and behaves as expected. Creating a custom pipeline involves custom processing of the incoming data, which should be done with caution and tested carefully.
192+
190193
`global@custom`::
191194
Apply processing to all events
192195
+
@@ -294,17 +297,240 @@ Refer to the breaking change in the 8.12.0 Release Notes for more detail and wor
294297
See <<data-streams-pipeline-tutorial>> to get started.
295298

296299
[[data-streams-ilm-tutorial]]
297-
== Tutorial: Customize data retention policies
300+
== Tutorials: Customize data retention policies
301+
302+
These tutorials explain how to apply a custom {ilm-init} policy to an integration's data stream.
303+
304+
[discrete]
305+
[[data-streams-general-info]]
306+
== Before you begin
307+
308+
For certain features you'll need to use a slightly different procedure to manage the index lifecycle:
309+
310+
* APM: For verions 8.15 and later, refer to {observability-guide}/apm-ilm-how-to.html[Index lifecycle management].
311+
* Synthetic monitoring: Refer to {observability-guide}/synthetics-manage-retention.html[Manage data retention].
312+
* Universal Profiling: Refer to {observability-guide}/profiling-index-lifecycle-management.html[Universal Profiling index life cycle management].
313+
314+
[discrete]
315+
[[data-streams-scenarios]]
316+
== Identify your scenario
317+
318+
How you apply an ILM policy depends on your use case. Choose a scenario for the detailed steps.
319+
320+
* **<<data-streams-scenario1,Scenario 1>>**: You want to apply an ILM policy to all logs or metrics data streams across all namespaces.
321+
322+
* **<<data-streams-scenario2,Scenario 2>>**: You want to apply an ILM policy to selected data streams in an integration.
323+
324+
* **<<data-streams-scenario3,Scenario 3>>**: You want apply an ILM policy for data streams in a selected namespace in an integration.
325+
326+
327+
[[data-streams-scenario1]]
328+
== Scenario 1: Apply an ILM policy to all data streams generated from Fleet integrations across all namespaces
329+
330+
++++
331+
<titleabbrev>Scenario 1: All data streams in all namespaces</titleabbrev>
332+
++++
333+
334+
NOTE: This tutorial uses a `logs@custom` and a `metrics@custom` component template which are available in versions 8.13 and later.
335+
For versions later than 8.4 and earlier than 8.13, you instead need to use the `<integration prefix>@custom component template` and add the ILM policy to that template.
336+
This needs to be done for every newly added integration.
337+
338+
Mappings and settings for data streams can be customized through the creation of `*@custom` component templates, which are referenced by the index templates created by each integration.
339+
The easiest way to configure a custom index lifecycle policy per data stream is to edit this template.
340+
341+
This tutorial explains how to apply a custom index lifecycle policy to all of the data streams associated with the `System` integration, as an example.
342+
Similar steps can be used for any other integration.
343+
Setting a custom index lifecycle policy must be done separately for all logs and for all metrics, as described in the following steps.
344+
345+
[discrete]
346+
[id="data-streams-scenario1-step1"]
347+
== Step 1: Create an index lifecycle policy
348+
349+
. To open **Lifecycle Policies**, find **Stack Management** in the main menu or use the {kibana-ref}/introduction.html#kibana-navigation-search[global search field].
350+
. Click **Create policy**.
351+
352+
Name your new policy.
353+
For this tutorial, you can use `my-ilm-policy`.
354+
Customize the policy to your liking, and when you're done, click **Save policy**.
355+
356+
[discrete]
357+
[id="data-streams-scenario1-step2"]
358+
== Step 2: Create a component template for the `logs` index templates
359+
360+
The **Index Templates** view in {kib} shows you all of the index templates available to automatically apply settings, mappings, and aliases to indices:
361+
362+
. To open **Index Management**, find **Stack Management** in the main menu or use the {kibana-ref}/introduction.html#kibana-navigation-search[global search field].
363+
. Select **Index Templates**.
364+
. Search for `system` to see all index templates associated with the System integration.
365+
. Select any `logs-*` index template to view the associated component templates. For example, you can select the `logs-system.application` index template.
366+
+
367+
[role="screenshot"]
368+
image::images/component-templates-list.png[List of component templates available for the index template]
369+
370+
. Select `logs@custom` in the list to view the component template properties.
371+
. For a newly added integration, the component template won't exist yet.
372+
Select **Create component template** to create it.
373+
If the component template already exists, click **Manage** to update it.
374+
. On the **Logistics** page, keep all defaults and click **Next**.
375+
. On the **Index settings** page, in the **Index settings** field, specify the ILM policy that you created. For example:
376+
+
377+
[source,json]
378+
----
379+
{
380+
"index": {
381+
"lifecycle": {
382+
"name": "my-ilm-policy"
383+
}
384+
}
385+
}
386+
----
387+
388+
. Click **Next**.
389+
. For both the **Mappings** and **Aliases** pages, keep all defaults and click **Next**.
390+
. Finally, on the **Review** page, review the summary and request. If everything looks good, select **Create component template**.
391+
+
392+
[role="screenshot"]
393+
image::images/review-component-template01.png[Review details for the new component template]
394+
395+
[discrete]
396+
[id="data-streams-scenario1-step3"]
397+
== Step 3: Roll over the data streams (optional)
298398

299-
This tutorial explains how to apply a custom {ilm-init} policy to an integration's data stream.
399+
To confirm that the index template is using the `logs@custom` component template with your custom ILM policy:
300400

301-
**Scenario:** You have {agent}s collecting system metrics with the System integration in two environments--one with the namespace `development`, and one with `production`.
401+
. Reopen the **Index Management** page and open the **Component Templates** tab.
402+
. Search for `logs@` and select the `logs@custom` component template.
403+
. The **Summary** shows the list of all data streams that use the component template, and the **Settings** view shows your newly configured ILM policy.
404+
405+
New ILM policies only take effect when new indices are created,
406+
so you either must wait for a rollover to occur (usually after 30 days or when the index size reaches 50 GB),
407+
or force a rollover of each data stream using the {ref}/indices-rollover-index.html[{es} rollover API.
408+
409+
For example:
410+
411+
[source,bash]
412+
----
413+
POST /logs-system.auth/_rollover/
414+
----
415+
416+
[discrete]
417+
[id="data-streams-scenario1-step4"]
418+
== Step 4: Repeat these steps for the metrics data streams
419+
420+
You've now applied a custom index lifecycle policy to all of the `logs-*` data streams in the `System` integration.
421+
For the metrics data streams, you can repeat steps 2 and 3, using a `metrics-*` index template and the `metrics@custom` component template.
422+
423+
424+
425+
[[data-streams-scenario2]]
426+
== Scenario 2: Apply an ILM policy to specific data streams generated from Fleet integrations across all namespaces
427+
428+
++++
429+
<titleabbrev>Scenario 2: Selected data streams in all namespaces</titleabbrev>
430+
++++
431+
432+
Mappings and settings for data streams can be customized through the creation of `*@custom` component templates,
433+
which are referenced by the index templates created by the {es} apm-data plugin.
434+
The easiest way to configure a custom index lifecycle policy per data stream is to edit this template.
435+
436+
This tutorial explains how to apply a custom index lifecycle policy to the `logs-system.auth` data stream.
437+
438+
[discrete]
439+
[id="data-streams-scenario2-step1"]
440+
== Step 1: Create an index lifecycle policy
441+
442+
. To open **Lifecycle Policies**, find **Stack Management** in the main menu or use the {kibana-ref}/introduction.html#kibana-navigation-search[global search field].
443+
. Click **Create policy**.
444+
445+
Name your new policy.
446+
For this tutorial, you can use `my-ilm-policy`.
447+
Customize the policy to your liking, and when you're done, click **Save policy**.
448+
449+
[discrete]
450+
[id="data-streams-scenario2-step2"]
451+
== Step 2: View index templates
452+
453+
The **Index Templates** view in {kib} shows you all of the index templates available to automatically apply settings, mappings, and aliases to indices:
454+
455+
. To open **Index Management**, find **Stack Management** in the main menu or use the {kibana-ref}/introduction.html#kibana-navigation-search[global search field].
456+
. Select **Index Templates**.
457+
. Search for `system` to see all index templates associated with the System integration.
458+
. Select the index template that matches the data stream for which you want to set up an ILM policy. For this example, you can select the `logs-system.auth` index template.
459+
+
460+
[role="screenshot"]
461+
image::images/index-template-system-auth.png[List of component templates available for the logs-system.auth index template]
462+
463+
. In the **Summary**, select `logs-system.auth@custom` from the list to view the component template properties.
464+
. For a newly added integration, the component template won't exist yet.
465+
Select **Create component template** to create it.
466+
If the component template already exists, click **Manage** to update it.
467+
.. On the **Logistics** page, keep all defaults and click **Next**.
468+
.. On the **Index settings** page, in the **Index settings** field, specify the ILM policy that you created. For example:
469+
+
470+
[source,json]
471+
----
472+
{
473+
"index": {
474+
"lifecycle": {
475+
"name": "my-ilm-policy"
476+
}
477+
}
478+
}
479+
----
480+
481+
.. Click **Next**.
482+
.. For both the **Mappings** and **Aliases** pages, keep all defaults and click **Next**.
483+
.. Finally, on the **Review** page, review the summary and request. If everything looks good, select **Create component template**.
484+
+
485+
[role="screenshot"]
486+
image::images/review-component-template02.png[Review details for the new component template]
487+
488+
[discrete]
489+
[id="data-streams-scenario2-step3"]
490+
== Step 3: Roll over the data streams (optional)
491+
492+
To confirm that the index template is using the `logs@custom` component template with your custom ILM policy:
493+
494+
. Reopen the **Index Management** page and open the **Component Templates** tab.
495+
. Search for `system` and select the `logs-system.auth@custom` component template.
496+
. The **Summary** shows the list of all data streams that use the component template, and the **Settings** view shows your newly configured ILM policy.
497+
498+
New ILM policies only take effect when new indices are created,
499+
so you either must wait for a rollover to occur (usually after 30 days or when the index size reaches 50 GB),
500+
or force a rollover of the data stream using the {ref}/indices-rollover-index.html[{es} rollover API:
501+
502+
[source,bash]
503+
----
504+
POST /logs-system.auth/_rollover/
505+
----
506+
507+
[discrete]
508+
[id="data-streams-scenario2-step4"]
509+
== Step 4: Repeat these steps for other data streams
510+
511+
You've now applied a custom index lifecycle policy to the `logs-system.auth` data stream in the `System` integration.
512+
Repeat these steps for any other data streams for which you'd like to configure a custom ILM policy.
513+
514+
515+
516+
[[data-streams-scenario3]]
517+
== Scenario 3: Apply an ILM policy with integrations using multiple namespaces
518+
519+
++++
520+
<titleabbrev>Scenario 3: Selected integrations and namespaces</titleabbrev>
521+
++++
522+
523+
In this scenario, you have {agent}s collecting system metrics with the System integration in two environments--one with the namespace `development`, and one with `production`.
302524

303525
**Goal:** Customize the {ilm-init} policy for the `system.network` data stream in the `production` namespace.
304526
Specifically, apply the built-in `90-days-default` {ilm-init} policy so that data is deleted after 90 days.
305527

306-
NOTE: If you cloned an index template to customize the data retention policy on an {es} version prior to 8.13, you must update the index template in the clone to use the `ecs@mappings` component template on {es} version 8.13 or later. See <<data-streams-pipeline-update-cloned-template-before-8.13,Update index template cloned before {es} 8.13>> for the step-by-step instructions.
528+
[NOTE]
529+
====
530+
* This scenario involves cloning an index template. We strongly recommend repeating this procedure on every minor {stack} upgrade in order to avoid missing any possible changes to the structure of the managed index template(s) that are shipped with integrations.
307531
532+
* If you cloned an index template to customize the data retention policy on an {es} version prior to 8.13, you must update the index template in the clone to use the `ecs@mappings` component template on {es} version 8.13 or later. See <<data-streams-pipeline-update-cloned-template-before-8.13,Update index template cloned before {es} 8.13>> for the step-by-step instructions.
533+
====
308534

309535
[discrete]
310536
[[data-streams-ilm-one]]
@@ -370,7 +596,14 @@ Now that you've created a component template,
370596
you need to create an index template to apply the changes to the correct data stream.
371597
The easiest way to do this is to duplicate and modify the integration's existing index template.
372598

373-
WARNING: When duplicating the index template, do not change or remove any managed properties. This may result in problems when upgrading.
599+
[WARNING]
600+
====
601+
Please note the following:
602+
* When duplicating the index template, do not change or remove any managed properties. This may result in problems when upgrading. Cloning the index template of an integration package involves some risk as any changes made to the original index template when it is upgraded will not be propagated to the cloned version.
603+
* These steps assume that you want to have a namespace specific ILM policy, which requires index template cloning. Cloning the index template of an integration package involves some risk because any changes made to the original index template as part of package upgrades are not propagated to the cloned version. See <<assets-restrictions-cloning-index-template>> for details.
604+
+
605+
If you want to change the ILM Policy, the number of shards, or other settings for the datastreams of one or more integrations, but **the changes do not need to be specific to a given namespace**, it's strongly recommended to use a `@custom` component template, as described in <<data-streams-scenario1,Scenario 1>> and <<data-streams-scenario2,Scenario 2>>, so as to avoid the problems mentioned above. See the <<data-streams-ilm,ILM>> section for details.
606+
====
374607

375608
. Navigate to **{stack-manage-app}** > **Index Management** > **Index Templates**.
376609
. Find the index template you want to clone. The index template will have the `<type>` and `<dataset>` in its name,
@@ -393,7 +626,7 @@ image::images/create-index-template.png[Create index template]
393626
== Step 4: Roll over the data stream (optional)
394627

395628
To confirm that the data stream is now using the new index template and {ilm-init} policy,
396-
you can either repeat <<data-streams-ilm-one,step one>>, or navigate to **{dev-tools-app}** and run the following:
629+
you can either repeat Step 1, or navigate to **{dev-tools-app}** and run the following:
397630

398631
[source,bash]
399632
----
@@ -691,22 +924,6 @@ You can modify your pipeline API request as needed to apply custom processing at
691924
Refer to <<data-streams-pipelines>> to learn more.
692925

693926

694-
695-
696-
697-
698-
699-
700-
701-
702-
703-
704-
705-
706-
707-
708-
709-
710927
[[data-streams-advanced-features]]
711928
== Enabling and disabling advanced indexing features for {fleet}-managed data streams
712929

200 KB
Loading
257 KB
Loading
566 KB
Loading
176 KB
Loading
202 KB
Loading

docs/en/ingest-management/integrations/integrations-assets-best-practices.asciidoc

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
[[integrations-assets-best-practices]]
2-
= Best practices for integrations assets
2+
= Best practices for integration assets
33

44
When you use integrations with {fleet} and {agent} there are some restrictions to be aware of.
55

66
* <<assets-restrictions-standalone>>
77
* <<assets-restrictions-without-agent>>
88
* <<assets-restrictions-custom-integrations>>
99
* <<assets-restrictions-copying>>
10+
* <<assets-restrictions-editing-assets>>
11+
* <<assets-restrictions-custom-component-templates>>
12+
* <<assets-restrictions-custom-ingest-pipeline>>
13+
* <<assets-restrictions-cloning-index-template>>
1014

1115
[discrete]
1216
[[assets-restrictions-standalone]]
@@ -46,3 +50,41 @@ This way, because the assets are not managed by another integration, there is le
4650

4751
Note, however, that creating standalone integration assets based off of {fleet} and {agent} integrations is considered a custom configuration that is not tested nor supported. Whenever possible it's recommended to use standard integrations.
4852

53+
[discrete]
54+
[[assets-restrictions-editing-assets]]
55+
== Editing assets managed by {fleet}
56+
57+
{fleet}-managed integration assets should not be edited. Examples of these assets include an integration index template, the `@package` component templates, and ingest pipelines that are bundled with integrations. Any changes made to these assets will be overwritten when the integration is upgraded.
58+
59+
[discrete]
60+
[[assets-restrictions-custom-component-templates]]
61+
== Creating custom component templates
62+
63+
While creating a `@custom` component template for a package integration is supported, it involves risks which can prevent data from being ingested correctly. This practice can lead to broken indexing, data loss, and breaking of integration package upgrades.
64+
65+
For example:
66+
67+
* If the `@package` component template of an integration is changed from a "normal" datastream to `TSDB` or `LogsDB`, some of the custom settings or mappings introduced may not be compatible with these indexing modes.
68+
* If the type of an ECS field is overridden from, for example, `keyword` to `text`, aggregations based on that field may be prevented for built-in dashboards.
69+
70+
A similar caution against custom index mappings is noted in <<data-streams-index-templates-edit>>.
71+
72+
[discrete]
73+
[[assets-restrictions-custom-ingest-pipeline]]
74+
== Creating a custom ingest pipeline
75+
76+
If you create a custom index pipeline (as documented in the <<data-streams-pipeline-tutorial,Transform data with custom ingest pipelines>> tutorial), Elastic is not responsible for ensuring that it indexes and behaves as expected. Creating a custom pipeline involves custom processing of the incoming data, which should be done with caution and tested carefully.
77+
78+
Refer to <<data-streams-pipelines>> to learn more.
79+
80+
[discrete]
81+
[[assets-restrictions-cloning-index-template]]
82+
== Cloning the index template of an integration package
83+
84+
When you clone the index template of an integration package, this involves risk as any changes made to the original index template when it is upgraded will not be propagated to the cloned version. That is, the structure of the new index template is effectively frozen at the moment that it is cloned. Cloning an index template of an integration package can therefore lead to broken indexing, data loss, and breaking of integration package upgrades.
85+
86+
Additionally, cloning index templates to add or inject additional component templates cannot be tested by Elastic, so we cannot guarantee that the template will work in future releases.
87+
88+
If you want to change the ILM Policy, the number of shards, or other settings for the datastreams of one or more integrations, but the changes do not need to be specific to a given namespace, it's highly recommended to use the `package@custom` component templates, as described in <<data-streams-scenario1,Scenario 1>> and <<data-streams-scenario2,Scenario 2>> of the Customize data retention policies tutorial, so as to avoid the problems mentioned above.
89+
90+
If you want to change these settings for the data streams in one or more integrations and the changes **need to be namespace specific**, then you can do so following the steps in <<data-streams-scenario3,Scenario 3>> of the Customize data retention policies tutorial, but be aware of the restrictions mentioned above.

0 commit comments

Comments
 (0)