Hi, Thanks for using Wazuh!
You can create an index state policy to manage ElasticSearch Indexes
To create an index state policy follow these steps:
- Go to Index Management.
- Create policy
- Provide a policy ID name.
- Create your Policy Json. Example below.
- Click Create
Policy Example:
{
"policy": {
"description": "Wazuh index state management for OpenDistro to move indices into a cold state after 30 days and delete them after 90 days.",
"default_state": "hot",
"states": [
{
"name": "hot",
"actions": [
{
"replica_count": {
"number_of_replicas": 1
}
}
],
"transitions": [
{
"state_name": "cold",
"conditions": {
"min_index_age": "30d"
}
}
]
},
{
"name": "cold",
"actions": [
{
"read_only": {}
}
],
"transitions": [
{
"state_name": "delete",
"conditions": {
"min_index_age": "90d"
}
}
]
},
{
"name": "delete",
"actions": [
{
"delete": {}
}
],
"transitions": []
}
],
"ism_template": {
"index_patterns": [
"wazuh-alerts*"
],
"priority": 100
}
}
}
The previous policy defines the following states:
- Hot state. It sets 1 replica for the indices and a transition to the cold state when indices are older than 30 days.
- Cold state. It sets indices into read-only mode and a transition to the delete state when indices are older than 90 days.
- Delete state. Indices in this state are deleted.
For already existing indices you can use an API call or the Index Management running the following command.
POST _opendistro/_ism/add/wazuh-alerts-* { "policy_id": "NAME_OF_YOUR_POLICY" }
Hope this answers your question.
Feel free to ask if you need more help.
Best Regards.