Failed to record snapshot for snapshot in policy policy not found – How to solve this Elasticsearch error

Opster Team

Aug-23, Version: 7.4-7.15

Briefly, this error occurs when Elasticsearch tries to execute a snapshot policy that doesn’t exist. The snapshot policy could have been deleted or not created yet. To resolve this issue, you can either create a new snapshot policy with the same name or update the existing policy to point to a valid snapshot policy. Also, ensure that the policy is correctly configured and that the Elasticsearch cluster has the necessary permissions to execute the snapshot policy.

This guide will help you check for common problems that cause the log ” failed to record snapshot [{}] for snapshot [{}] in policy [{}]: policy not found ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: snapshot, plugin.

Log Context

Log “failed to record snapshot [{}] for snapshot [{}] in policy [{}]: policy not found” classname is SnapshotLifecycleTask.java.
We extracted the following from Elasticsearch source code for those seeking an in-depth context :

            }

            Map snapLifecycles = new HashMap(snapMeta.getSnapshotConfigurations());
            SnapshotLifecyclePolicyMetadata policyMetadata = snapLifecycles.get(policyName);
            if (policyMetadata == null) {
                logger.warn("failed to record snapshot [{}] for snapshot [{}] in policy [{}]: policy not found";
                    exception.isPresent() ? "failure" : "success"; snapshotName; policyName);
                return currentState;
            }

            SnapshotLifecyclePolicyMetadata.Builder newPolicyMetadata = SnapshotLifecyclePolicyMetadata.builder(policyMetadata);

 

 [ratemypost]