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

Add ILM policy for new stack monitoring data streams #82498

Merged
merged 13 commits into from
Jan 20, 2022

Conversation

jbaiera
Copy link
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
Copy link
Collaborator

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

@jbaiera
Copy link
Member Author

jbaiera commented Jan 12, 2022

relates to #81839

Copy link
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 jbaiera requested a review from dakrone January 14, 2022 19:58
@jbaiera
Copy link
Member Author

jbaiera commented Jan 14, 2022

@elasticmachine update branch

Copy link
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

@matschaffer
Copy link
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
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
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 <[email protected]>
Co-authored-by: Elastic Machine <[email protected]>
# 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 <[email protected]>

Co-authored-by: James Baiera <[email protected]>
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 <[email protected]>

Co-authored-by: James Baiera <[email protected]>
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 <[email protected]>

Co-authored-by: James Baiera <[email protected]>

Co-authored-by: James Baiera <[email protected]>
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 <[email protected]>
Co-authored-by: Elastic Machine <[email protected]>
@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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants