Set up hot-warm architecture

289 views
Skip to first unread message

Thaynara Soares

unread,
Jan 8, 2025, 2:09:06 PM1/8/25
to Wazuh | Mailing List
I would like help implementing the hot-warm architecture in my infrastructure

My Environment

-Two Indexers
-Wazuh 4.9.2

-I checked the documentation https://documentation.wazuh.com/current/user-manual/wazuh-indexer/index-life-management.html, and I wanted help with the node configuration part where I would put node.attr.temp: hot in the file /etc/wazuh-indexer/opensearch.yml


Diego Andrés Cappri

unread,
Jan 8, 2025, 3:59:46 PM1/8/25
to Wazuh | Mailing List
Hi Thaynara,
apologies for the delay. You can place this line at the bottom of the file if you want, but to keep the structure organized it's recommended to add it to the "node configuration section" where node.roles is placed.
Hope this help.

Thaynara Soares

unread,
Jan 8, 2025, 4:20:01 PM1/8/25
to Wazuh | Mailing List
Another question, do I need to inform which index will be hot and which will be warm? Or do I configure both? I have two indexes in my environment.

Thaynara Soares

unread,
Jan 8, 2025, 4:48:03 PM1/8/25
to Wazuh | Mailing List

I wanted to test it first in my homologation environment, but it is only one machine for the index, master and work. It is not in a cluster, as I would test the hot-warm architecture, or is it only done in a cluster?

Diego Andrés Cappri

unread,
Jan 9, 2025, 8:03:41 AM1/9/25
to Wazuh | Mailing List
Hi,
you can add these lines in your .yaml:

node.name: "wazuh-indexer-homologation"
node.roles: [data, ingest, master]
node.attr.temp: hot_warm
cluster.routing.allocation.awareness.attributes: temp

Then restart the wazuh-indexer and check for the attribute is applied -> curl -X GET "http://localhost:9200/_nodes?pretty" | grep -A5 "node.attr.temp"

Hope this help

Thaynara Soares

unread,
Jan 9, 2025, 12:01:48 PM1/9/25
to Wazuh | Mailing List
Screenshot_24.png
After adding it, do I put the policy in and apply it to the indexes?


- Policy

PUT _plugins/_ism/policies/hot_warm
{
    "policy": {
        "description": "Send shards from hot to warm nodes",
        "schema_version": 17,
        "error_notification": null,
        "default_state": "hot",
        "states": [
            {
                "name": "hot",
                "actions": [],
                "transitions": [
                    {
                        "state_name": "warm",
                        "conditions": {
                            "min_index_age": "30d"
                        }
                    }
                ]
            },
            {
                "name": "warm",
                "actions": [
                    {
                        "retry": {
                            "count": 3,
                            "backoff": "exponential",
                            "delay": "1m"
                        },
                        "replica_count": {
                            "number_of_replicas": 0
                        }
                    },
                    {
                        "retry": {
                            "count": 3,
                            "backoff": "exponential",
                            "delay": "1m"
                        },
                        "allocation": {
                            "require": {
                                "temp": "warm"
                            },
                            "include": {},
                            "exclude": {},
                            "wait_for": false
                        }
                    }
                ],
                "transitions": []
            }
        ],
        "ism_template": [
            {
                "index_patterns": [
                    "wazuh-alerts-*"
                ],
                "priority": 1
            }
        ]
    }
}




Diego Andrés Cappri

unread,
Jan 9, 2025, 2:57:19 PM1/9/25
to Wazuh | Mailing List
Hi, you will need to create Index Lifecycle Management:

PUT _ilm/policy/wazuh-hot-warm-policy
{
  "policy": {
    "phases": {
      "hot": {
        "actions": {
          "rollover": {
            "max_age": "7d",
            "max_size": "10gb"
          }
        }
      },
      "warm": {
        "actions": {
          "allocate": {
            "require": {
              "temp": "hot_warm"
            }
          },
          "forcemerge": {
            "max_num_segments": 1
          }
        }
      }
    }
  }
}


Then apply it:
PUT _index_template/wazuh-hot-warm-template
{
  "index_patterns": ["wazuh-alerts-*"],
  "template": {
    "settings": {
      "index.lifecycle.name": "wazuh-hot-warm-policy"
    }
  }
}

Thaynara Soares

unread,
Jan 9, 2025, 3:32:48 PM1/9/25
to Wazuh | Mailing List
Screenshot_25.png
Not sure, is that how you add it?

Diego Andrés Cappri

unread,
Jan 9, 2025, 4:21:43 PM1/9/25
to Wazuh | Mailing List
Run the following command on your Wazuh Indexer server:
curl -X PUT "http://localhost:9200/_ilm/policy/wazuh-hot-warm-policy" -H "Content-Type: application/json" -d '

{
  "policy": {
    "phases": {
      "hot": {
        "actions": {
          "rollover": {
            "max_age": "7d",
            "max_size": "10gb"
          }
        }
      },
      "warm": {
        "actions": {
          "allocate": {
            "require": {
              "temp": "hot_warm"
            }
          },
          "forcemerge": {
            "max_num_segments": 1
          }
        }
      }
    }
  }
}'

Thaynara Soares

unread,
Jan 9, 2025, 5:13:39 PM1/9/25
to Wazuh | Mailing List
Screenshot_26.png

Diego Andrés Cappri

unread,
Jan 9, 2025, 5:38:44 PM1/9/25
to Wazuh | Mailing List
Hi, please restart wazuh-indexer service, the try this command to check -> curl -X GET "http://localhost:9200/_ilm/policy/wazuh-hot-warm-policy?pretty"

Thaynara Soares

unread,
Jan 10, 2025, 11:32:47 AM1/10/25
to Wazuh | Mailing List
Screenshot_27.png

Diego Andrés Cappri

unread,
Jan 10, 2025, 1:43:39 PM1/10/25
to Wazuh | Mailing List
Is there any error log you can share? Is the wazuh-indexer starting ok? Please check if it's listening : curl -X GET "http://localhost:9200/_ilm/policy?pretty" -u <user>:<passwd>

Thaynara Soares

unread,
Jan 10, 2025, 2:11:37 PM1/10/25
to Wazuh | Mailing List
It gives the same error (curl: (52) Empty reply from server), I think my homologation environment needs resources, I would have to test it in the production environment.

-My production environment is in a cluster, could you help me? I have 2 Indexes

Diego Andrés Cappri

unread,
Jan 13, 2025, 5:33:41 AM1/13/25
to Wazuh | Mailing List
Hi, here's the documentation for this: https://documentation.wazuh.com/current/user-manual/wazuh-indexer/index-life-management.html. As mentioned before, you can place this line at the bottom of the file if you want, but to keep the structure organized it's recommended to add it to the "node configuration section" where node.roles is placed.

Thaynara Soares

unread,
Jan 13, 2025, 12:15:37 PM1/13/25
to Wazuh | Mailing List
Add to:

-Index01

node.attr.temp: hot

-Index02

node.attr.temp: warm 

That way ?

Thaynara Soares

unread,
Jan 13, 2025, 3:01:42 PM1/13/25
to Wazuh | Mailing List
My setup:

configuration  nano  /etc/wazuh-indexer/opensearch.yml

Screenshot_32.pngScreenshot_33.png

-I added the Test Policy for 1 day

{
    "policy": {
        "description": "Send shards from hot to warm nodes",
        "schema_version": 17,
        "error_notification": null,
        "default_state": "hot",
        "states": [
            {
                "name": "hot",
                "actions": [],
                "transitions": [
                    {
                        "state_name": "warm",
                        "conditions": {
                            "min_index_age": "1d"

-I applied the Policy to the test indexers

-wazuh-alerts-4.x-2024.10.03

-wazuh-alerts-4.x-2024.10.02

-Is it correct?

Thaynara Soares

unread,
Jan 13, 2025, 3:04:14 PM1/13/25
to Wazuh | Mailing List
Screenshot_34.png

-It ended up like this, is that correct? If I want to access this data on the panel, can I? Or do I need to remove it from warm?

Thaynara Soares

unread,
Jan 13, 2025, 4:50:21 PM1/13/25
to Wazuh | Mailing List
Does this architecture help to save disk space?

Diego Andrés Cappri

unread,
Jan 14, 2025, 6:37:11 AM1/14/25
to Wazuh | Mailing List
Hi, Hot-Warm architecture doesn’t directly reduce disk space but enhances storage efficiency by leveraging forcemerge, automated deletions, and tiered storage. You will need to take a look to ILM policies to manage disk usage. 

Thaynara Soares

unread,
Jan 14, 2025, 11:55:21 AM1/14/25
to Wazuh | Mailing List
Is there any way to compress old data to free up more space without having to delete it?

Thaynara Soares

unread,
Jan 14, 2025, 3:33:06 PM1/14/25
to Wazuh | Mailing List
How do I create a policy for this, with Index01 being the hot node and Index02 the cold node, and so that the data on Index02 is compact and I can then decompress it and it is not deleted?

Diego Andrés Cappri

unread,
Jan 14, 2025, 4:42:20 PM1/14/25
to Wazuh | Mailing List
Please try creating the policy

PUT _ilm/policy/wazuh-hot-cold-policy
{
  "policy": {
    "phases": {
      "hot": { "actions": { "rollover": { "max_age": "30d", "max_size": "50gb" } } },
      "cold": {
        "actions": {
          "allocate": { "require": { "temp": "cold" } },
          "forcemerge": { "max_num_segments": 1 },
          "set_priority": { "priority": 0 }
        }
      }
    }
  }
}


then assign the polixy to indeces

PUT _index_template/wazuh-hot-cold-template
{
  "index_patterns": ["wazuh-alerts-*"],
  "template": { "settings": { "index.lifecycle.name": "wazuh-hot-cold-policy" } }
}

check the status

GET _ilm/policy/wazuh-hot-cold-policy?pretty
GET _ilm/explain/wazuh-alerts-2024.01.01
GET _cat/indices?v

decompress data when required

POST wazuh-alerts-2024.01.01/_refresh
POST wazuh-alerts-2024.01.01/_forcemerge?max_num_segments=5


it is possible that you need to adapt/modify/troubleshoot in your environment to reach the final result, please let me know

Thaynara Soares

unread,
Jan 14, 2025, 4:51:10 PM1/14/25
to Wazuh | Mailing List

You need to make some changes to the nano /etc/wazuh-indexer/opensearch.yml file

Thaynara Soares

unread,
Jan 14, 2025, 4:54:51 PM1/14/25
to Wazuh | Mailing List

Because I want Index01 as a hot node and Index02 as a cold node, Adding just this policy will free up space in Index 02. As cold and I want it to free up space in Index01 because those in Index02 I don't want it to stay in Index01

Diego Andrés Cappri

unread,
Jan 15, 2025, 6:47:42 AM1/15/25
to Wazuh | Mailing List
Hi, please check this:

PUT _ilm/policy/wazuh-hot-cold-policy
{
  "policy": {
    "phases": {
      "hot": {
        "actions": {
          "rollover": {
            "max_age": "30d",
            "max_size": "50gb"
          },
          "shrink": {
            "number_of_shards": 1

          }
        }
      },
      "cold": {
        "actions": {
          "allocate": {
            "require": {
              "temp": "cold"
            }
          },
          "forcemerge": {
            "max_num_segments": 1
          },
          "set_priority": {
            "priority": 0
          }
        }
      }
    }
  }
}

And apply the policy to indices:

Thaynara Soares

unread,
Jan 15, 2025, 12:46:07 PM1/15/25
to Wazuh | Mailing List
Screenshot_35.png
It didn't work

Diego Andrés Cappri

unread,
Jan 15, 2025, 3:56:27 PM1/15/25
to Wazuh | Mailing List

Hi. Ensure the field names (policy, phases, actions, etc.) are all lowercase and properly nested, make sure the "phases" key is inside the "policy" object and each phase (hot, cold) must have an actions object.

Thaynara Soares

unread,
Jan 16, 2025, 1:09:31 PM1/16/25
to Wazuh | Mailing List

It's not working, could you show me the correct way?

Diego Andrés Cappri

unread,
Jan 16, 2025, 4:10:47 PM1/16/25
to Wazuh | Mailing List
Hi, sorry for the delayed response. Could you please for OpenSearch version doing: curl -X GET "http://localhost:9200/" and try the following command to simulate the policy and identify the issue:

PUT _ilm/policy/wazuh-hot-cold-policy?error_trace=true

Thaynara Soares

unread,
Jan 16, 2025, 4:31:43 PM1/16/25
to Wazuh | Mailing List
These commands requested by you do not work on my server.

Diego Andrés Cappri

unread,
Jan 17, 2025, 9:22:31 AM1/17/25
to Wazuh | Mailing List
Is there an error you can share?

Thaynara Soares

unread,
Jan 17, 2025, 12:51:44 PM1/17/25
to Wazuh | Mailing List
curl: (52) Empty reply from server

Nicolas Zapata

unread,
Jan 20, 2025, 9:46:53 AM1/20/25
to Wazuh | Mailing List
Hi Thaynara!

The error curl: (52) Empty reply from server typically indicates that the server closed the connection without sending a response.
Can you please check the service status using the below command:
systemctl status wazuh-indexer

Reply all
Reply to author
Forward
0 new messages