Skip to content

Latest commit

 

History

History
124 lines (94 loc) · 3.85 KB

example-index-lifecycle-policy.asciidoc

File metadata and controls

124 lines (94 loc) · 3.85 KB

Tutorial: Customize built-in {ilm-init} policies

Customize built-in {ilm-init} policies

{es} includes the following built-in {ilm-init} policies:

  • logs

  • metrics

  • synthetics

{agent} uses these policies to manage backing indices for its data streams. This tutorial shows you how to use {kib}’s Index Lifecycle Policies to customize these policies based on your application’s performance, resilience, and retention requirements.

Scenario

You want to send log files to an {es} cluster so you can visualize and analyze the data. This data has the following retention requirements:

  • When the write index reaches 50GB or is 30 days old, roll over to a new index.

  • After rollover, keep indices in the hot data tier for 30 days.

  • 30 days after rollover:

    • Move indices to the warm data tier.

    • Set replica shards to 1.

    • Force merge multiple index segments to free up the space used by deleted documents.

  • Delete indices 90 days after rollover.

Prerequisites

To complete this tutorial, you’ll need:

  • An {es} cluster with hot and warm data tiers.

    • {ess}: Elastic Stack deployments on {ess} include a hot tier by default. To add a warm tier, edit your deployment and click Add capacity for the warm data tier.

      Add a warm data tier to your deployment
    • Self-managed cluster: Assign data_hot and data_warm roles to nodes as described in [data-tiers].

      For example, include the data_warm node role in the elasticsearch.yml file of each node in the warm tier:

      node.roles: [ data_warm ]
  • A host with {agent} installed and configured to send logs to your {es} cluster.

View the policy

{agent} uses data streams with an index pattern of logs-- to store log monitoring data. The built-in logs {ilm-init} policy automatically manages backing indices for these data streams.

To view the logs policy in {kib}:

  1. Open the menu and go to Stack Management > Index Lifecycle Policies.

  2. Select the logs policy.

The logs policy uses the recommended rollover defaults: Start writing to a new index when the current write index reaches 50GB or becomes 30 days old.

To view or change the rollover settings, click Advanced settings for the hot phase. Then disable Use recommended defaults to display the rollover settings.

View rollover defaults

Modify the policy

The default logs policy is designed to prevent the creation of many tiny daily indices. You can modify the policy to meet your performance requirements and manage resource usage.

  1. Activate the warm phase and click Advanced settings.

    1. Set Move data into phase when to 30 days old. This moves indices to the warm tier 30 days after rollover.

    2. Enable Set replicas and change Number of replicas to 1.

    3. Enable Force merge data and set Number of segments to 1.

    Add a warm phase with custom settings
  2. In the warm phase, click the trash icon to enable the delete phase.

    Enable the delete phase

    In the delete phase, set Move data into phase when to 90 days old. This deletes indices 90 days after rollover.

    Add a delete phase
  3. Click Save Policy.