Skip to content

Add ILM policy for new stack monitoring data streams#82498

Merged
jbaiera merged 13 commits intoelastic:masterfrom
jbaiera:monitoring-ilm-policy
Jan 20, 2022
Merged

Add ILM policy for new stack monitoring data streams#82498
jbaiera merged 13 commits intoelastic:masterfrom
jbaiera:monitoring-ilm-policy

Conversation

@jbaiera
Copy link
Copy Markdown
Member

@jbaiera jbaiera commented Jan 12, 2022

Adds a templated ILM policy with a 3 day or 50 gb rollover and a 3 day retention period by default. The retention period checks the value set in xpack.monitoring.history.duration and uses that for the retention period if it is present. Depending on which default it uses, the _meta field is updated with the reasoning for picking the default retention value:

The defaults

{
    ".monitoring-8-ilm-policy": {
        "version": 1,
        "modified_date": "2022-01-12T21:53:55.278Z",
        "policy": {
            "phases": {
                "warm": {
                    "min_age": "0ms",
                    "actions": {
                        "forcemerge": {
                            "max_num_segments": 1
                        }
                    }
                },
                "hot": {
                    "min_age": "0ms",
                    "actions": {
                        "rollover": {
                            "max_primary_shard_size": "50gb",
                            "max_age": "3d"
                        }
                    }
                },
                "delete": {
                    "min_age": "3d",
                    "actions": {
                        "delete": {
                            "delete_searchable_snapshot": true
                        }
                    }
                }
            },
            "_meta": {
                "defaults": {
                    "delete_min_age": "Using value of [3d] based on the monitoring plugin default"
                },
                "managed": true,
                "description": "Index lifecycle policy generated for [monitoring-*-8] data streams"
            }
        },
        "in_use_by": {
            "indices": [],
            "data_streams": [],
            "composable_templates": [
                ".monitoring-beats-mb",
                ".monitoring-kibana-mb",
                ".monitoring-es-mb",
                ".monitoring-logstash-mb"
            ]
        }
    }
}

Setting xpack.monitoring.history.duration to the value 4d at start up

{
    ".monitoring-8-ilm-policy": {
        "version": 1,
        "modified_date": "2022-01-12T20:42:01.835Z",
        "policy": {
            "phases": {
                "warm": {
                    "min_age": "0ms",
                    "actions": {
                        "forcemerge": {
                            "max_num_segments": 1
                        }
                    }
                },
                "hot": {
                    "min_age": "0ms",
                    "actions": {
                        "rollover": {
                            "max_primary_shard_size": "50gb",
                            "max_age": "3d"
                        }
                    }
                },
                "delete": {
                    "min_age": "4d",
                    "actions": {
                        "delete": {
                            "delete_searchable_snapshot": true
                        }
                    }
                }
            },
            "_meta": {
                "defaults": {
                    "delete_min_age": "Using value of [4d] based on the value of the [xpack.monitoring.history.duration] setting at node startup"
                },
                "managed": true,
                "description": "Index lifecycle policy generated for [monitoring-*-8] data streams"
            }
        },
        "in_use_by": {
            "indices": [],
            "data_streams": [],
            "composable_templates": [
                ".monitoring-beats-mb",
                ".monitoring-kibana-mb",
                ".monitoring-es-mb",
                ".monitoring-logstash-mb"
            ]
        }
    }
}

Also included is a small enhancement to allow for template variable replacement in ILM policy resource files.

@elasticmachine elasticmachine added the Team:Data Management (obsolete) DO NOT USE. This team no longer exists. label Jan 12, 2022
@elasticmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-data-management (Team:Data Management)

@jbaiera
Copy link
Copy Markdown
Member Author

jbaiera commented Jan 12, 2022

relates to #81839

Copy link
Copy Markdown
Member

@dakrone dakrone left a comment

Choose a reason for hiding this comment

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

Generally looks good, I left a couple of comments.

Can you also add a test for this similar to what we do for StackTemplateRegistryTests? That way we can test the duration copying from the setting into the ILM policy and ensure it works correctly.

jbaiera and others added 2 commits January 13, 2022 11:56
Co-authored-by: Lee Hinman <dakrone@users.noreply.github.com>
@jbaiera jbaiera requested a review from dakrone January 14, 2022 19:58
@jbaiera
Copy link
Copy Markdown
Member Author

jbaiera commented Jan 14, 2022

@elasticmachine update branch

Copy link
Copy Markdown
Member

@dakrone dakrone left a comment

Choose a reason for hiding this comment

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

LGTM, I left two suuuper minor things

jbaiera and others added 4 commits January 14, 2022 15:29
Co-authored-by: Lee Hinman <dakrone@users.noreply.github.com>
Co-authored-by: Lee Hinman <dakrone@users.noreply.github.com>
@matschaffer
Copy link
Copy Markdown
Contributor

Reviewing this made me notice we're going to need a monitoring-entsearch as well. Looks like the mapping isn't there atm anyway so we'll just have to remember to include ILM when we add it (probably as part of elastic/kibana#121975)

matschaffer added a commit to matschaffer/elasticsearch that referenced this pull request Jan 17, 2022
Copy link
Copy Markdown
Contributor

@matschaffer matschaffer left a comment

Choose a reason for hiding this comment

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

I gave this a try locally and LGTM

@jbaiera
Copy link
Copy Markdown
Member Author

jbaiera commented Jan 18, 2022

@elasticmachine update branch

@jbaiera jbaiera deleted the monitoring-ilm-policy branch January 20, 2022 19:52
jbaiera added a commit to jbaiera/elasticsearch that referenced this pull request Jan 20, 2022
Adds a templated ILM policy with a 3 day or 50 gb rollover and a 3 day retention period by default.
The retention period checks the value set in xpack.monitoring.history.duration and uses that for
the retention period if it is present. Depending on which default it uses, the _meta field is updated
with the reasoning for picking the default retention value.

Co-authored-by: Lee Hinman <dakrone@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
# Conflicts:
#	x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/template/LifecyclePolicyConfig.java
#	x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/MlNativeIntegTestCase.java
matschaffer added a commit that referenced this pull request Jan 24, 2022
* Upgrade documentation for xpack.monitoring.history.duration

* A few updates now that #82498 has been opened with a concrete policy.

* Grammar fix

* Update docs/reference/migration/migrate_8_0/cluster-node-setting-changes.asciidoc

Co-authored-by: James Baiera <james.baiera@gmail.com>

Co-authored-by: James Baiera <james.baiera@gmail.com>
matschaffer added a commit to matschaffer/elasticsearch that referenced this pull request Jan 24, 2022
…82295)

* Upgrade documentation for xpack.monitoring.history.duration

* A few updates now that elastic#82498 has been opened with a concrete policy.

* Grammar fix

* Update docs/reference/migration/migrate_8_0/cluster-node-setting-changes.asciidoc

Co-authored-by: James Baiera <james.baiera@gmail.com>

Co-authored-by: James Baiera <james.baiera@gmail.com>
elasticsearchmachine pushed a commit that referenced this pull request Jan 24, 2022
…82920)

* Upgrade documentation for xpack.monitoring.history.duration

* A few updates now that #82498 has been opened with a concrete policy.

* Grammar fix

* Update docs/reference/migration/migrate_8_0/cluster-node-setting-changes.asciidoc

Co-authored-by: James Baiera <james.baiera@gmail.com>

Co-authored-by: James Baiera <james.baiera@gmail.com>

Co-authored-by: James Baiera <james.baiera@gmail.com>
jbaiera added a commit that referenced this pull request Jan 24, 2022
…82892)

Adds a templated ILM policy with a 3 day or 50 gb rollover and a 3 day retention period by default.
The retention period checks the value set in xpack.monitoring.history.duration and uses that for
the retention period if it is present. Depending on which default it uses, the _meta field is updated
with the reasoning for picking the default retention value.

Co-authored-by: Lee Hinman <dakrone@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
@jakelandis jakelandis mentioned this pull request Feb 9, 2022
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Core/Infra/Monitoring DEPRECATED, DO NOT USE >enhancement Team:Data Management (obsolete) DO NOT USE. This team no longer exists. v8.0.0 v8.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants