-
Notifications
You must be signed in to change notification settings - Fork 9
Spike - Viability analysis of creating ISM policies within a plugin #435
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
Comments
Investigation of how the ISM plugin persists such data
UPDATE
|
Complete test of policy to rollover based on the previous issueTest the issue stepsTest the issue stepsApplied an ISM policy for rollover as follows:
curl -XPOST -k -u admin:$admin_pass "https://127.0.0.1:9200/.opendistro-ism-config/_doc/MANUAL_wazuh_rollover_policy" -H 'Content-Type: application/json' -d'
{
"policy": {
"policy_id": "MANUAL_wazuh_rollover_policy",
"description": "Wazuh rollover and alias policy created directly on index .opendistro-ism-config",
"last_updated_time": 1737572429671,
"schema_version": 21,
"error_notification": null,
"default_state": "active",
"states": [
{
"name": "active",
"actions": [
{
"retry": {
"count": 3,
"backoff": "exponential",
"delay": "1m"
},
"rollover": {
"min_size": "250mb",
"copy_alias": false
}
}
],
"transitions": []
}
],
"ism_template": [
{
"index_patterns": [
"wazuh-alerts-*"
],
"priority": 50,
"last_updated_time": 1737572429671
}
],
"user": {
"name": "admin",
"backend_roles": [
"admin"
],
"roles": [
"own_index",
"all_access"
],
"custom_attribute_names": [],
"user_requested_tenant": null
}
}
}'
{
RESULT
RESULT |
Simple ISM configurationBelow there is a simple ISM configuration to automatically roll over the PUT _template/wazuh-commands
{
"index_patterns": [
"wazuh-commands*"
],
"mappings": {
"date_detection": false,
"dynamic": "true",
"properties": {
"@timestamp": {
"type": "date"
},
"agent": {
"properties": {
"groups": {
"ignore_above": 1024,
"type": "keyword"
}
}
},
"command": {
"properties": {
"action": {
"properties": {
"args": {
"type": "object"
},
"name": {
"ignore_above": 1024,
"type": "keyword"
},
"version": {
"ignore_above": 1024,
"type": "keyword"
}
}
},
"order_id": {
"ignore_above": 1024,
"type": "keyword"
},
"request_id": {
"ignore_above": 1024,
"type": "keyword"
},
"result": {
"properties": {
"code": {
"type": "short"
},
"data": {
"ignore_above": 1024,
"type": "keyword"
},
"message": {
"ignore_above": 1024,
"type": "keyword"
}
}
},
"source": {
"ignore_above": 1024,
"type": "keyword"
},
"status": {
"ignore_above": 1024,
"type": "keyword"
},
"target": {
"properties": {
"id": {
"ignore_above": 1024,
"type": "keyword"
},
"type": {
"ignore_above": 1024,
"type": "keyword"
}
}
},
"timeout": {
"type": "short"
},
"user": {
"ignore_above": 1024,
"type": "keyword"
}
}
},
"delivery_timestamp": {
"type": "date"
}
}
},
"order": 1,
"settings": {
"index": {
"number_of_replicas": "0",
"number_of_shards": "1",
"query.default_field": [
"command.source",
"command.target.type",
"command.status",
"command.action.name"
],
"refresh_interval": "5s",
"plugins.index_state_management.rollover_alias": "wazuh-commands"
}
},
"version": 500
} PUT _plugins/_ism/policies/wazuh_rollover_policy
{
"policy": {
"description": "Wazuh rollover and alias policy",
"default_state": "active",
"states": [
{
"name": "active",
"actions": [
{
"rollover": {
"min_index_age": "5m"
}
}
]
}
],
"ism_template": {
"index_patterns": ["wazuh-commands*"],
"priority": "50"
}
}
} PUT wazuh-commands-0001
{
"aliases": {
"wazuh-commands": {
"is_write_index": true
}
}
} |
Test ISM rollover configuration by creating the policy directly on the index
|
Define aliases nameThe best options to the alias are the name for the index without any aggregation of number, date or anything:
Because the prefix "wazuh" indicates that these are indexes generated for Wazuh automatically. |
Define rollover policiesAfter careful consideration and analysis of the requirements from both the previous issues and industry best practices, I think the best options to implement a rollover policy for Wazuh data streams are the following conditions:
Justification:
PoliciesPolicy for
|
We were able to get the policy to be applied from our setup plugin: Comments in the PR explain how to try that out. |
A viable approach has been demonstrated on the PoC in the linked PR. However, a new official OpenSearch plugin was released in the meantime which may cover our needs: I'm running a quick PoC to test whether this can be used to load an ISM policy on startup. |
Upon closer inspection, the As of today, the code of the plugin still looks somewhat minimal: I don't think this will be useful at all to load our own ISM policies, since the policies themselves are documents. |
I've been trying to use the |
Uh oh!
There was an error while loading. Please reload this page.
Description
Related issues:
One of the main requirements of the Indexer initialization plugin project is to include aliases and rollover policies to stream indices by default, as Index Management related features.
For Wazuh 5, we have identified 2 stream indices:
wazuh-alerts
data stream.wazuh-archives
data stream.The
setup
plugin (see #9) generates indices for both data streams at startup,wazuh-alerts-5.x-0001
andwazuh-archives-5.x-0001
respectively.On this issue, we are going to create aliases and rollover policies for both data streams, defining the rollover criteria.
We have not yet found a simple way of interacting with the OpenSearch's Indexer Management plugin, which is responsible for these things. As part of this issue, we will investigate how to implement these features within our
setup
plugin.Functional requirements
wazuh-alerts
data stream is associated to an alias.wazuh-alerts
data stream is managed by an active rollover policy.wazuh-archives
data stream is associated to an alias.wazuh-archives
data stream is managed by an active rollover policy.Implementation restrictions
setup
plugin.Plan
The text was updated successfully, but these errors were encountered: