Adding index lifecycle policy – How to solve related issues

Opster Team

Feb-21, Version: 1.7-8.0

Before you begin reading about how to address this log, we recommend you run the Elasticsearch Error Check-Up to resolve this issue and prevent others.

This guide will help you check for common problems that cause the log “adding index lifecycle policy” to appear. It’s important to understand the issues related to it, so to get started, read the general overview on common issues and tips related to the Elasticsearch concepts: index and plugin.

What the index lifecycle policy is

The index lifecycle management (commonly known as ILM) enables you to automate how you want to manage your indices over time. This will take care of automatically managing indices according to various requirements like performance, resilience, deleting old indices and retention requirements.

Refer to this documentation on ILM to learn more about this policy.

How to reproduce this log

To set up index lifecycle policy, you need to define the policy as shown below (change the policy according to your use case).

Create index lifecycle policy:

PUT /_ilm/policy/my_policy
{
 "policy": {
   "phases": {
     "warm": {
       "min_age": "10d",
       "actions": {
         "forcemerge": {
           "max_num_segments": 1
         }
       }
     },
     "delete": {
       "min_age": "20d",
       "actions": {
         "delete": {}
       }
     }
   }
 }
}

The log generated will be:

[INFO ][o.e.x.i.a.TransportPutLifecycleAction] adding index lifecycle policy [my_policy]

What this message means

It’s an INFO message letting you know that an index lifecycle management policy is set up. The first step is to define a lifecycle policy so that the index can use this ILM policy to manage its lifecycle. The above request creates a policy called my_policy in Elasticsearch which can be later used to manage the indices. When the policy is created, Elasticsearch will log it as shown above.

Log Context

Log “adding index lifecycle policy [{}]” classname is TransportPutLifecycleAction.java.
We extracted the following from Elasticsearch source code for those seeking an in-depth context :

                         SortedMap newPolicies = new TreeMap(currentMetadata.getPolicyMetadatas());
                        LifecyclePolicyMetadata lifecyclePolicyMetadata = new LifecyclePolicyMetadata(request.getPolicy(); filteredHeaders;
                            nextVersion; Instant.now().toEpochMilli());
                        LifecyclePolicyMetadata oldPolicy = newPolicies.put(lifecyclePolicyMetadata.getName(); lifecyclePolicyMetadata);
                        if (oldPolicy == null) {
                            logger.info("adding index lifecycle policy [{}]"; request.getPolicy().getName());
                        } else {
                            logger.info("updating index lifecycle policy [{}]"; request.getPolicy().getName());
                        }
                        IndexLifecycleMetadata newMetadata = new IndexLifecycleMetadata(newPolicies; currentMetadata.getOperationMode());
                        stateBuilder.metaData(MetaData.builder(currentState.getMetaData())




 

Watch product tour

Try AutoOps to find & fix Elasticsearch problems

Analyze Your Cluster
Skip to content