Curator - delete all indices based on "alias" name (prefix+timestring)


(Olivier C.) #1

Hi,

I would like delete all indices older than xxx days based on alias name (prefix+timestring) and not index name.

Is it possible ?

action: delete_indices >>> action: delete_indices_from_alias

ex:

alias > log-20170506
indexes > log-A1
indexes > log-B2
indexes > log-D1

name log-
timestring: '%Y%m%d'
unit: days
unit_count: xxx

Thx for help.

Best Regards


(tri-man) #2

You may find the info at the link below
https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html


(Olivier C.) #3

I m not sure this page could be help me.

Because I would like use curator actions. It is for cron task to automatic delete old indexes.

Like this but regex on alias name doesn't work. Or How use timestring on Alias name.

actions:
1:
action: alias
description: >-
Alias indices
options:
name: log-?????????
warn_if_no_indices: True
ignore_empty_list: True
timeout_override:
continue_if_exception: False
disable_action: False
remove:
filters:
- filtertype: pattern
kind: regex
value: 'log.*'
- filtertype: age
source: name
direction: older
timestring: '%Y%m%d'
unit: days
unit_count: 1
exclude:


(Aaron Mildenstein) #4

Try Curator's alias filter. It will keep only indices associated with a named alias. However, it currently requires fully named aliases. You can't specify alias-%Y.%m.%d to select aliases older than unit_count units.


(Olivier C.) #5

I can not provide fully named aliases. Because it is exactly what I want to do.
Get indices from alias-%Y.%m.%d...

Same thing that "delete_indices" but from alias and not index name.

So, for now, I will use the elasticsearch java api with a custom program.

Waiting a new curator version with this function ^^.

Thx a lot.


(Aaron Mildenstein) #6

It won't happen without a feature request at https://github.com/elastic/curator

Please go and add that feature there.


(system) #7

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