[root@wazuh-server .curator]# cat delete.yml
actions:
1:
action: 'delete_indices'
description: |
Delete all indices whose name starts with 'wazuh-alerts-3.x-' and that have
been created more than 30 days ago.
options:
continue_if_exception: False
disable_action: False
ignore_empty_list: True
filters:
- filtertype: 'pattern'
kind: 'prefix'
value: 'wazuh-alerts-3.x-'
- filtertype: 'age'
source: 'name'
timestring: '%Y.%m.%d'
direction: 'older'
unit: 'days'
unit_count: 365
So, this action file will define a rule in order to remove all indices with pattern wazuh-alerts-3.x- and older than 365. If we want to execute it:
curator delete.yml --dry-run
You will need to have a configuration file (described in the top of this message) in
~/.curator folder. And the
--dry-run allow you to execute the command without no actions, only for review the possible results that you'll be able to see in
/var/log/curator/curator.log. If you are sure about the execution of this command and you want to definitively remove the older than 365 indices, then:
By removing --dry-run we skip the "simulation mode".
The last step that you'll need is automatizing the process every day/month. We could use cron e.g:
and then add the line:
0 6 1 * * root curator /path/delete_index.yml --config /path/curator.yml
This cron will execute the removing task every day 1 of every month at 06:00 AM.
Hope it help.