Wazuh alert retention with index state management policies

Wazuh alert indices grow until something removes them. Index state management (ISM) policies automate rollover and deletion so retention matches your compliance requirements and disk budget.

On this page

Wazuh alert retention with ISM policies: when your team needs automated deletion

**Index State Management (ISM) deletes or rolls over wazuh-alerts-* indices on a schedule you define, so the indexer does not fill its disks with alerts nobody needs.** Teams need it once alert volume grows faster than manual cleanup can keep up, or once a written retention rule exists that someone must enforce every day. The Wazuh indexer is the full-text search and analytics engine that stores the alerts the Wazuh server produces, and it keeps them until something removes them. Retention is therefore a configuration decision you make, not a default you inherit. Before you write any policy, confirm the ISM behavior, the policy syntax and the index naming for the exact Wazuh and indexer versions you run, because the API and template format are version-dependent and a mistake can delete data earlier than intended.

This section covers the decisions that come before the JSON: how long each data class must stay searchable, whether deletion applies to all alert indices or only some, and who owns the rule when a compliance requirement changes. The rest of the page walks through policy design, the index template that attaches the policy to new wazuh-alerts-* indices, applying the policy to indices that already exist, and mapping retention periods to the requirements your auditors read. Start by listing the frameworks in scope, such as the PCI DSS requirements that call for log retention, and by asking your compliance lead which period applies. Whether a requirement is met by keeping logs in the indexer, in archives or in another store is a decision to document with your assessor, not one this page can settle.

Test every policy on a non-production cluster before enabling it on production. Confirm that the policy attaches to a new index, that the rollover or deletion conditions trigger when expected, and that the indices you intended to keep are still searchable in the Wazuh dashboard. Record the policy version, the indexer version and the test date in your change log, because the retention rule is evidence you may need to show later. Deleted alerts cannot be recovered from the indexer, so pair the policy with snapshots if you need a longer-term copy, and check the Wazuh documentation for any release changes before each upgrade.

Which retention approach fits your environment

This is the simplest model: an ISM policy deletes each index once it reaches a set age. It suits teams with a clear, documented retention period, a stable alert volume and a small security operations group that wants retention to run without routine intervention. Operator attention is low after the policy is tested, but the policy must be reviewed whenever the required retention period changes, since the deletion timing is fixed in the policy.

  • Operator effort: Mostly one-time design and periodic review of the policy and its index matches.
  • Reviewer questions: Which retention period applies to which alert data, who approved it, and where that decision is recorded.
  • Risk: Indices are removed as a block, so a single misconfigured age or pattern can delete data earlier than intended.
  • Evidence: Policy definitions, the ISM explain output for sample indices, and a record of a test deletion in a non-production cluster.
  • Cost model: Storage cost is predictable only if you measure your own alert volume and set the age with that data in view.

Before relying on this approach, confirm the retention period with your compliance owner and check how your Wazuh version applies ISM policies to existing indices.

Retention policy options and when each fits

This table compares the ISM policy settings that decide how long Wazuh alert indices stay searchable and when they are deleted. Read each row as a setting, what it controls, and the trade-off it creates between search availability and disk use. The main takeaway is that the retention period you pick must be checked against the longest requirement that applies to your alerts, not the shortest one that saves disk.

SettingWhat it controlsWhen it fits and the trade-off
Rollover conditionWhen the active wazuh-alerts index is closed and a new write index starts, based on size, document count or ageUse size or age limits to keep individual shards at a manageable size. Smaller rollover intervals create more indices and more shards, which adds cluster overhead.
Minimum index age before deletionHow long an index must exist before the delete action can runSet this to the retention period your compliance owner confirms. Measure from index creation, so a rollover policy can make the effective retention look shorter or longer than expected.
Delete timingThe state and age at which the delete action runs, after earlier states such as hot or warmDeleting sooner frees disk but removes alerts from search and dashboards. Keep older indices searchable for as long as investigations may need them, then delete on schedule.
Replica countNumber of copies kept of each primary shard during the retention windowMore replicas improve resilience to node loss but roughly multiply storage used by each index. Reducing replicas on older data can reduce disk use, but confirm the resilience you still need with your platform team.
Shard countPrimary shards per index, which sets how data is split across indexer nodesShard count affects storage overhead and how evenly data spreads across nodes. Changing it on existing indices requires re-indexing, so plan it before the first rollover rather than during retention work.
Snapshot before deleteWhether indexed alerts are backed up in a snapshot repository before the index is removedAdding a snapshot step keeps long-term copies outside the live cluster. It needs a repository with enough capacity and a restore test, so confirm both before relying on it for evidence.
Template for wazuh-alerts-*The index template that attaches the policy to new indices matching the naming patternAttach the policy in the template so new indices inherit it. Indices created before the template was applied need the policy set on them separately, so check existing indices after each change.

How to write, attach and verify a Wazuh retention policy

This sequence turns a retention decision into an ISM policy that applies to new and existing wazuh-alerts-* indices, with a check at each step so the team can see the policy working before any deletion runs.

  1. Confirm versions and current index naming

    Record the Wazuh indexer, server and dashboard versions, and confirm they match each other on the 4.14 release line. List the existing alert indices with the indexer API or the dashboard Dev Tools console and note the naming pattern, the daily rollover style and any indices already carrying a policy. Check the ISM plugin is present on the indexer nodes and that the account running these steps holds the index management privileges it needs. Done when you have a written inventory of versions, index names, index counts and total storage, and you know which indices are not yet managed by any policy.

  2. Write the retention policy in ISM

    Draft the ISM policy as JSON with a hot state, an optional transition or rollover state, and a delete state with a minimum index age. The age must come from your documented retention requirement, which your compliance or legal owner should confirm, not from a default in this guide. Validate the JSON with a dry review by a second engineer and store the file in version control. Done when the policy file reviews cleanly and its delete age matches the approved retention decision in writing.

  3. Create the index template for new indices

    Create an index template whose pattern matches wazuh-alerts-* and that references the ISM policy through the index.plugins.index_state_management.policy_id setting, so each new daily index inherits the policy at creation. Keep the shard and replica settings in the template unchanged from your current configuration so this step does not alter layout. Check the template priority so it does not conflict with any Wazuh-provided template. Done when a test index matching the pattern shows the policy attached after creation, or when you confirm the template is registered and the next daily index receives it.

  4. Apply the policy to existing indices

    Attach the policy to indices that already exist using the ISM add operation, selecting by pattern and only the indices you approved in the inventory. Do not apply a delete state to indices outside the approved set. Before this step, take a snapshot of the indices that a delete state would reach, so a wrong age or pattern can be recovered from. Done when the explain output lists each targeted index with the policy ID and an initialized state, and no unexpected index appears in the list.

  5. Verify state transitions with the explain API

    Run the ISM explain call for the wazuh-alerts-* pattern and read each index's current state, action and step. Confirm that an index younger than the transition age stays in its current state and that the policy shows the expected next condition. For the first delete, pick a test index in a non-production copy or a dedicated test cluster if one exists, and confirm the age condition reads the same value you set. Done when every explain entry shows a status you can predict from its creation date.

  6. Set a rollback and hold before the first deletion

    Before the policy first runs a delete action on production data, record the rollback path: a verified snapshot of the affected indices, the restore procedure from your snapshot runbook, and the person authorized to pause the policy with the ISM change or remove-policy operations. Pause or remove the policy on any index you do not want deleted, and confirm the hold appears in the explain output. Done when the snapshot restore has been tested on a sample index and the approver has signed off on the list of indices that will be deleted.

  7. Confirm the first delete and keep monitoring

    After the first delete window passes, compare the explain output and the remaining index list against the inventory. Confirm that only indices older than the approved age were removed, that the template still attaches the policy to new indices, and that the snapshot repository still holds the backups you planned to keep. Record the result, then schedule periodic reviews of the policy against any change in retention requirements. Done when the post-run inventory matches the approved retention decision and the review date is recorded.

How an alert index moves from creation to deletion

The path starts at the Wazuh server, which writes decoded and ruled events as alerts into a wazuh-alerts index in the Wazuh indexer. An index state management policy, attached through an index template that matches the wazuh-alerts pattern, then moves each index through its states, from active writing through rollover to deletion. Snapshots and archives sit beside this path as a separate decision, so check that the retention you configure does not remove data your investigations or compliance evidence still need.

Alert index path from event ingestion to deletion, with snapshots shown as a separate decision.

Matching retention to PCI DSS and other compliance requirements

The retention period you configure in ISM is one technical input, and the period itself must be set by your compliance owner, not by this page or by the SIEM. PCI DSS and other frameworks set outcomes that your logs must support, such as keeping audit trail history available for investigation, but the standard does not hand you a number that the Wazuh indexer can simply adopt. Your qualified assessor decides whether your evidence is sufficient, and the payment brands decide which entities must validate and run any enforcement. Confirm the retention period with your assessor and your legal team, including any contractual or local legal obligations that may be longer than the card-brand expectations, and record that decision in writing before you change any policy.

The Payment Card Industry Security Standards Council (PCI SSC) is clear that a compliance certificate is not validation. An assessment is documented on official PCI SSC templates: a Report on Compliance (ROC) completed by a Qualified Security Assessor, or a Self-Assessment Questionnaire (SAQ), each supported by an Attestation of Compliance (AOC). When you hand evidence to an assessor, the question they ask is whether your logging and retention controls, as operated, meet the relevant requirements in your environment. Practical inputs include the ISM policy export, the index names it applies to, the date the policy took effect, and proof that deletion and rollover ran as scheduled. Keep the policy definition under change control so you can show what applied during any period under review.

Retention is also where a customized approach or a compensating control may come into play. PCI DSS v4.x allows the customized approach for entities with robust security and risk management, but that route requires the assessor's agreement and its own evidence, and a compensating control is not a shortcut around a missing setting. If your retention period differs from what your assessor expects, or if you plan to keep some alerts in a different store such as archives or snapshots, raise it early with the assessor. Note that PCI DSS v4.0.1 is the only active version, and the PCI SSC has announced no release date for the next iteration, so re-check the requirement text your assessor uses at each assessment cycle rather than relying on a value copied from an older checklist.

Security and operational risks of automated deletion

Automated deletion removes data on a schedule, so a mistake repeats until someone notices. The cards below cover the risks that matter most for Wazuh alert retention and the control to put in place for each before any policy deletes an index.

Deleting data under a legal hold

A retention policy that deletes wazuh-alerts-* indices on age does not know about investigations, litigation or regulator requests. Before enabling deletion, record which investigations and holds could touch alert data and who can pause a policy. Confirm with your legal and compliance teams how long alerts tied to an open matter must stay searchable, and build an exception process that stops deletion for those indices. Check the hold list before every policy change.

Accidental deletion from broad patterns

A policy that matches too many indices can delete data you meant to keep, such as indices holding other events or test data. Scope the ISM template to the exact index patterns you intend, and review which indices a policy matches before applying it to existing data. Illustrative example: a wildcard that also matches a renamed archive index would expire months of records in one run. Test the pattern against a list of current index names first.

Deletion that skips snapshots

ISM deletes indices directly, and a deleted index does not come back unless a snapshot exists. Decide which indices need a snapshot before deletion, and make snapshot creation a required step in the policy or in a pre-deletion job. Restore a test snapshot to confirm the data is readable. The snapshot procedure is covered in the snapshots topic, so verify that the repository is healthy before relying on it.

Policy failures nobody notices

An ISM policy can stall on an error, so indices stop rolling over or deleting while the dashboard looks normal. Check the managed index status regularly and alert on indices stuck in a failed step. Keep a written list of expected policy states and review it after each Wazuh upgrade or indexer change. A silent failure means storage fills up or retention drifts from what your compliance requirements say.

Who can change retention policies

Anyone who can edit an ISM policy can shorten retention or disable deletion, and anyone who can delete indices can destroy evidence. Limit policy changes and index deletion to a small administrator group in the indexer security roles, separate from analysts who only read alerts. Require a second reviewer for changes to retention periods. Confirm which roles in your deployment hold cluster-level permissions before you rely on them.

Audit trail for retention changes

Without a record of who changed a retention period and when, you cannot show an auditor or your own team why data disappeared. Keep policy definitions in version control and log every change to ISM policies and index deletions. Store those logs outside the indexer that holds the alerts, so an administrator cannot erase the record of their own change. Review the trail on a fixed schedule.

Questions buyers ask about Wazuh retention work

What does Wazuh retention work cost and what drives the effort?

The cost depends on how many indices the policy touches, how many environments need it (lab, staging, production), how well your retention periods are already defined, and how many people must sign off. The main cost components are the time to write the retention requirements, the ISM policy and template, testing on a non-production indexer, applying the policy to existing indices, and the evidence you keep afterward. Most of that work is one-time. Ongoing costs are reviews after each Wazuh upgrade and any changes to retention periods. We do not publish prices. Ask for a quote built from a written scope that lists the environments, the retention periods and the deliverables.

How long does a Wazuh retention policy project take?

Duration follows from the same inputs as cost: the number of environments, how quickly retention periods are agreed, whether existing indices need a backfill, and how long your change process takes for production. Retention decisions often take longer than the technical change because legal, compliance and data owners must agree on periods. Ask for a timeline in the written scope that separates requirement sign-off, test runs on a non-production indexer, the production change window and the post-change check. We do not state a duration until the scope is agreed.

What must our team provide before a retention engagement starts?

Your team needs to supply the retention periods by data type, the owners who approve them, a list of Wazuh indexer nodes and index naming in use, current disk and snapshot repository details, and access to a non-production indexer that matches production closely enough to test. Your change board or deployment process must also be available for the production window. Without agreed periods and a test environment, the policy can only be drafted, not verified.

Can our own team write and run the ISM retention policy?

Yes, if your engineers can read the indexer documentation, test changes safely and keep records of what they changed. The work is not difficult in isolation, but mistakes are costly: a policy that matches the wrong index pattern or deletes data too early cannot be undone without a snapshot. Teams that do it themselves usually need a test environment, a reviewed change record and a second person to check the policy. An outside partner can take on the design, testing and documentation so your team can run the policy afterward.

How do retention policies relate to snapshots and backups?

Retention deletes indices after the period you set, and a snapshot is a copy you can restore from. They are separate controls. If you delete an index that has no snapshot, the data is gone. If you need alerts for a longer period than the live indices keep, a snapshot repository or an archive process must hold them, and that copy must be tested by restoring it. Confirm the snapshot schedule and repository retention before you shorten any live retention period, and ask the team to document which control protects which data.

What will an assessor ask for to prove our retention controls work?

Assessors usually ask for the written retention requirement, evidence that the policy is configured as written, proof that it runs on schedule, and records of any exceptions or changes. For Wazuh, that means the policy definition, the template and its application to indices, indexer logs or status output showing deletions and transitions, and approval records. Frameworks differ in what they require, so confirm with your assessor which periods and evidence they expect. DeployOpen prepares the systems, configuration and evidence for compliance assessments, but independent auditors issue any report or attestation.

Which retention periods do compliance frameworks require for Wazuh alerts?

Frameworks set requirements for outcomes, and the required retention period depends on the framework, your sector and the data involved. For example, payment card assessments under PCI DSS are organized into 12 principal requirements, and your assessor or the payment brands decide what applies to your environment. Ask your compliance lead and assessor to name the retention periods in writing before the policy is built, then map each period to the requirement it supports.

How DeployOpen scopes Wazuh retention work

Retention policy work is scoped as a fixed-scope engagement with the scope, deliverables and timeline agreed in writing before any change is made to the Wazuh indexer. For an ISM retention project, that written scope should name the index pattern being covered (the wazuh-alerts-* indices and any other patterns the team stores), the minimum and maximum retention periods for each, the policy names, the list of existing indices to be attached, and the evidence the client expects at the end. Ask for the scope to state who approves the retention periods, because those periods usually come from legal, compliance or the data owner rather than from the security engineers doing the build. A quote follows from that written scope, so a vague scope produces a vague quote.

DeployOpen tests each policy transition in the client's own environment before the policy is treated as finished. That means creating a test index with the same mapping and naming pattern, confirming the policy state moves through its phases as written, checking that replicas and shard counts match the design, and confirming that deletion removes only the intended indices. The test should also cover the behavior of indices that already exist when the policy is applied, since those are where unplanned deletions tend to happen. Ask for the test results in writing, with the policy definitions and the outputs that show each transition. These are technical records of how the system behaved, not an audit report. Independent assessors, not DeployOpen, decide whether retention meets a framework requirement.

Ongoing review is available as a retainer for teams whose retention needs change, for example after a Wazuh upgrade, a change in log sources, or a new compliance obligation. A retainer covers periodic review of the policies, checks that indices are being rolled over and deleted as designed, and updates to the written evidence. Confirm with the vendor and in your own environment which index management features your installed Wazuh indexer version provides before you rely on them, and confirm the retention periods with your compliance owner. DeployOpen prepares the technical controls and evidence for those reviews, and any report or attestation comes from an independent auditor or certification body.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.