Regarding to curator delete indices older than 5 days

I'd verify that with --dry-run first.

Hi Aaron, I need to create a script to delete indices older than 3 months, I have viewed those indices name, for instance: user, logstash-2014-09-08, student...

As u can see, their name is defined in different format, but I just need to delete indices older than 3 months,
How can I write the filters? Here's what I wrote down for one specific index name 'user', how to change the first filtertype to work for all types of indices name? Thank you for your instruction.

filters:

  • filtertype: pattern
    kind: regex
    value: '^user$'
    exclude:
  • filtertype: age
    source: creation_date
    direction: older
    unit: months
    unit_count: 3
    exclude:

If you are deleting indices by age, with no regard for name, then you can omit the filtertype: pattern portion from the filters. However, as mentioned, you will want to run this with --dry-run first to make sure it's not deleting things you might not want deleted, like the .kibana index.

Thanks, and one more question is since now every time I need to update my action.yml to implement indices deletion, just want to understand how to automatically delete data after certain days? On what criteria can the data be deleted? Thanks.

In Unix-like systems, you would execute your curator command line in cron:

0 2 * * * /usr/bin/curator --config MYCONFIG.YML ACTIONFILE.YML

This will run Curator every day at 2am (server time).

In Windows, you would need to use the task scheduler, or some app that provides similar functionality.

Hi Aaron,

I want to delete all indices based on the creation date except .kibana. I have used --dry-run to verify that, but it seems like it's not correct to implement that using the following scripts, any ideas about my script? Thanks.

actions:
1:
action: delete_indices
description: "Delete indices older than 5 days (based on index name)
Ignore the error if the filter does not result in an actionable list of indices (ignore_empty_list) and exit cleanly"
options:
timeout_override:
continue_if_exception: False
disable_action: False
filters:
- filtertype:kibana
exclude:False
- filtertype: age
source: creation_date
direction: older
unit: days
unit_count: 5
exclude:

Please start a new topic with that question, as the original question was answered.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.