Skip to content
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

[DOCS] Add ILM tutorial #59502

Merged
merged 8 commits into from
Apr 13, 2020
Merged
Show file tree
Hide file tree
Changes from 3 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
Binary file added docs/images/tutorial-ilm-custom-policy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/tutorial-ilm-delete-rollover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,23 +1,167 @@
[role="xpack"]

[[example-using-index-lifecycle-policy]]
=== Example of using an index lifecycle policy
=== Tutorial: Use ILM to manage Filebeat time-based indices
Copy link
Contributor

@jrodewig jrodewig Apr 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We maintain a list of attributes here: https://github.com/elastic/docs/blob/master/shared/attributes.asciidoc

Try to use those when possible. They ensure we can make docs-wide term changes easily.

Suggested change
=== Tutorial: Use ILM to manage Filebeat time-based indices
=== Tutorial: Use {ilm-init} to manage {filebeat} time-based indices


With index lifecycle management (ILM), you can create policies to define actions
Copy link
Contributor

@jrodewig jrodewig Apr 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
With index lifecycle management (ILM), you can create policies to define actions
With {ilm} ({ilm-init}), you can create policies to define actions

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm replacing an existing page, so I was leaving the old anchor in case it was referenced elsewhere. Do you still suggest to change it?

that are automatically performed against indices as they age. In this tutorial,
you will use {kib}’s *Index Lifecycle Policies* to modify and create ILM policies.
Copy link
Contributor

@jrodewig jrodewig Apr 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With index lifecycle management (ILM), you can create policies to define actions that are automatically performed against indices as they age.

This implies that ILM only works based on age, but we can also take actions based on index size or number of docs. More importantly, this doesn't really address the why of ILM. It helps you automatically manage your indices for performance and retention. You may want to consider reusing a sentence from https://www.elastic.co/guide/en/elasticsearch/reference/master/overview-index-lifecycle-management.html.

In this tutorial, you will use Kibana’s Index Lifecycle Policies to modify and create ILM policies.

Nit: I'd reword to avoid future tense if possible. Something like:

This tutorial shows you how to use use {kib}'s *Index Lifecycle Policies* to
create and change {ilm-init} policies.

The bolded Index Lifecycle Policies seemed unnecessary to me, but maybe that's just a Kibana docs style.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, it's a Kibana docs style.



[float]
==== Scenario
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should use [discrete] instead of [float] when possible. I'd also add an explicit anchor here.

Suggested change
[float]
==== Scenario
[discrete]
[[example-using-index-lifecycle-policy-scenario]]
==== Scenario


You’ve been tasked with sending syslog files to an {es} cluster. This
project has the following data retention guidelines for log data:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
You’ve been tasked with sending syslog files to an {es} cluster. This
project has the following data retention guidelines for log data:
You’re tasked with sending syslog files to an {es} cluster. This
log data has the following data retention guidelines:


* Keep logs on hot data nodes for 30 days
Copy link
Contributor

@jrodewig jrodewig Apr 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the first mention of hot-warm architecture.

If readers should be familiar with those concepts, maybe add a link to a conceptual doc in the introduction?

* Rollover to a new index if the size reaches 50GB
Copy link
Contributor

@jrodewig jrodewig Apr 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Roll over" should be two words when used as a verb. One word as a noun.

Suggested change
* Rollover to a new index if the size reaches 50GB
* Roll over any index containing log data to a new index when it reaches 50GB

* After 30 days:
** Move the logs to warm data nodes
** Set replicas to 1
** Force merge indices to a single segment
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

** Set replicas to 1
** Force merge indices to a single segment

I think these two items need more context/explanation. I imagine many users may not be familiar with the concept of replicas, force merges, or segments. At the least, provide a link.

* Delete logs after 90 days


[float]
==== Prerequisites
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add an explicit anchor here.

Suggested change
[float]
==== Prerequisites
[discrete]
[[example-using-index-lifecycle-policy-prerequisites]]
==== Prerequisites


To complete this tutorial, you'll need:

* An {es} cluster with hot and warm nodes configured for shard allocation
awareness. If you’re using https://www.elastic.co/guide/en/cloud/current/ec-getting-started-templates-hot-warm.html[Elasticsearch Service],
Copy link
Contributor

@jrodewig jrodewig Apr 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
awareness. If you’re using https://www.elastic.co/guide/en/cloud/current/ec-getting-started-templates-hot-warm.html[Elasticsearch Service],
awareness. If you’re using {cloud}/ec-getting-started-templates-hot-warm.html[{ess}],

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did some more checking and index level allocation appears to be what is used, it is related to shard allocation awareness. https://www.elastic.co/guide/en/elasticsearch/reference/current/shard-allocation-filtering.html

The Index-level page mentions ILM.

Suggested change
* An {es} cluster with hot and warm nodes configured for shard allocation
awareness. If you’re using https://www.elastic.co/guide/en/cloud/current/ec-getting-started-templates-hot-warm.html[Elasticsearch Service],
* An {es} cluster with hot and warm nodes configured for index-level shard allocation
filtering. If you’re using https://www.elastic.co/guide/en/cloud/current/ec-getting-started-templates-hot-warm.html[Elasticsearch Service],

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to add shard allocation filtering.

choose the hot-warm architecture deployment template.

+
For a self-managed cluster, use https://www.elastic.co/guide/en/elasticsearch/reference/current/allocation-awareness.html[shard allocation awareness]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Attributes are especially helpful when linking across books. Generally, avoid using any /current/ links as they change with each release. They're prone to breaking if a book removes or rearranges its pages.

Suggested change
For a self-managed cluster, use https://www.elastic.co/guide/en/elasticsearch/reference/current/allocation-awareness.html[shard allocation awareness]
For a self-managed cluster, use {ref}/allocation-awareness.html[shard allocation awareness]

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one should point to https://www.elastic.co/guide/en/elasticsearch/reference/current/shard-allocation-filtering.html @jrodewig would that be {ref}/shard-allocation-filtering.html[index-level shard allocation filtering] even though the page is in Elasticsearch docs and not Kibana?

to label data nodes as hot or warm. This step is required to migrate shards between
nodes using shard allocation awareness.
+
For example, you can set this in `elasticsearch.yml` for each data node:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
For example, you can set this in `elasticsearch.yml` for each data node:
For example, you can set this in your `elasticsearch.yml` for each data node:

+
[source,yaml]
--------------------------------------------------------------------------------
node.attr.data: "warm"
--------------------------------------------------------------------------------

* A server with Filebeat installed and configured to send logs to the `elasticsearch`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add ending period

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* A server with Filebeat installed and configured to send logs to the `elasticsearch`
* A server with {filebeat} installed and configured to send logs to the `elasticsearch`

output as described in https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-getting-started.html[Getting Started with Filebeat].
Copy link
Contributor

@jrodewig jrodewig Apr 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
output as described in https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-getting-started.html[Getting Started with Filebeat].
output as described in {filebeat-ref}/filebeat-getting-started.html[Getting Started with {filebeat}].


[float]
==== View the Filebeat ILM policy
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explicit anchor

Suggested change
[float]
==== View the Filebeat ILM policy
[discrete]
[[example-using-index-lifecycle-policy-view-fb-ilm-policy]]
==== View the {filebeat} {ilm-init} policy


Filebeat includes a default ILM policy that enables rollover. Index lifecycle
management is enabled automatically if you’re using the default `filebeat.yml`
and index template.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Filebeat includes a default ILM policy that enables rollover. Index lifecycle
management is enabled automatically if you’re using the default `filebeat.yml`
and index template.
{filebeat} includes a default {ilm-init} policy that enables rollover. {ilm-cap}
is enabled automatically if you’re using the default `filebeat.yml`
and index template.


To view the default policy in {kib}, go to *Management > Index Lifecycle Policies*,
search for _filebeat_, and choose the _filebeat-version_ policy.

This policy initiates the rollover action when the index size reaches 50G or 30
days old.
Copy link
Contributor

@jrodewig jrodewig Apr 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This policy initiates the rollover action when the index size reaches 50G or 30
days old.
This policy initiates the rollover action when the index size reaches 50GB or
the index becomes 30 days old.

It may be helpful to very briefly explain what a rollover is here.


[role="screenshot"]
image::images/tutorial-ilm-hotphaserollover-default.png["Default policy"]


[float]
==== Modify the policy

The default policy is enough to prevent the creation of many tiny daily indices.
You can modify the policy to meet more complex requirements.

. Activate the warm phase.

+
. Set either of the following options to control when the index moves to the warm phase:

** Provide a value for *Timing for warm phase*. Setting this to *15* will keep the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd put this first because it is the default.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
** Provide a value for *Timing for warm phase*. Setting this to *15* will keep the
** Provide a value for *Timing for warm phase*. Setting this to *15* keeps the

indices on hot nodes for a range of 15-45 days, depending on when the initial
rollover occurred.

** Enable *Move to warm phase on rollover*. The index might move to the warm phase
more quickly than intended if it reaches the *Maximum index size* before
*Maximum age*.
mellieA marked this conversation as resolved.
Show resolved Hide resolved

. In *Select a node attribute to control shard allocation*, select *data:warm(2)* in
the dropdown to migrate shards to warm data nodes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
. In *Select a node attribute to control shard allocation*, select *data:warm(2)* in
the dropdown to migrate shards to warm data nodes.
. In the *Select a node attribute to control shard allocation* dropdown, select *data:warm(2)* to
migrate shards to warm data nodes.


. Change *Number of replicas* to *1*.

. Enable *Force merge data* and set *Number of segments* to *1*.
+
NOTE: When rollover is enabled in the hot phase, action timing in the other phases
is based on the rollover date.

+
[role="screenshot"]
image::images/tutorial-ilm-modify-default-warm-phase-rollover.png["Modify to add warm phase"]

. Activate the delete phase and set *Timing for delete phase* to *90* days.
+
[role="screenshot"]
image::images/tutorial-ilm-delete-rollover.png["Add a delete phase"]

[float]
==== Create a custom policy

If meeting a specific retention time period is your most important priority, you
can create a custom policy. For this option, you will use Filebeat daily indices
without rollover.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
If meeting a specific retention time period is your most important priority, you
can create a custom policy. For this option, you will use Filebeat daily indices
without rollover.
If meeting a specific retention time period important, you
can create a custom policy. For this option, you will use {filebeat} daily indices
without rollover.


To create a custom policy in {kib}, go to *Management > Index Lifecycle Policies >
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be step 1?

Create Policy*.


. Activate the warm phase and configure it as follows:
+
|===
|*Setting* |*Value*

|Timing for warm phase
|30 days from index creation

|Node attribute
|`data:warm`

|Number of replicas
|1

|Force merge data
|enable

|Number of segments
|1
|===

+
[role="screenshot"]
image::images/tutorial-ilm-custom-policy.png["Modify the custom policy to add a warm phase"]

A common use case for managing index lifecycle policies is when you’re using
{beats-ref}/beats-reference.html[Beats] to continually send time-series data,
such as metrics and log data, to {es}. When you create the Beats packages, an
index template is installed. The template includes a default policy to apply
when new indices are created.

You can edit the policy in {kib}'s *Index Lifecycle Policies*. For example, you might:
+
. Activate the delete phase and set the timing.
+
|===
|*Setting* |*Value*
|Timing for delete phase
|90
|===

* Rollover the index when it reaches 50 GB in size or is 30 days old. These
settings are the default for the Beats lifecycle policy. This avoids
having 1000s of tiny indices. When a rollover occurs, a new “hot” index is
created and added to the index alias.
+
[role="screenshot"]
image::images/tutorial-ilm-delete-phase-creation.png["Delete phase"]

* Move the index into the warm phase, shrink the index down to a single shard,
and force merge to a single segment.
. Configure the index to use the new policy in *{kib} > Management > Index Lifecycle
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is hard to parse. Can you make it a series of substeps?
3. Configure the index to use the new policy.
a. In Index Lifecycle Policies, select your policy.
b....
c....

Policies > _Select your custom policy_ > Actions > Add policy to template > Select
your Filebeat index template*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
your Filebeat index template*
your Filebeat index template*.


* After 60 days, move the index into the cold phase and onto less expensive hardware.
+
NOTE: If you initially used the default Filebeat ILM policy, you will see a notice that the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
NOTE: If you initially used the default Filebeat ILM policy, you will see a notice that the
NOTE: If you initially used the default {filebeat} {ilm-init} policy, you will see a notice that the

template already has a policy associated with it. Confirm that you want to
overwrite that configuration.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The NOTE admonition above is inline with the previous numbered item. The TIP admonition is not.

It's fine either way. Just wanted to point that out.

If you'd like both to be inline, just add a + to line 172.

* Delete the index after 90 days.
TIP: When you change the policy associated with the index template, the active
index will continue to use the policy it was associated with at index creation
unless you manually update it. The next new index will use the updated policy.
For more reasons that your ILM policy changes might be delayed, see https://www.elastic.co/guide/en/elasticsearch/reference/current/update-lifecycle-policy.html#update-lifecycle-policy[Update Lifecycle Policy].
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
For more reasons that your ILM policy changes might be delayed, see https://www.elastic.co/guide/en/elasticsearch/reference/current/update-lifecycle-policy.html#update-lifecycle-policy[Update Lifecycle Policy].
For more reasons that your {ilm-init} policy changes might be delayed, see {ref}/update-lifecycle-policy.html#update-lifecycle-policy[Update Lifecycle Policy].