Curator: Running delete on multiple prefixes

Created on 22 Oct 2014  路  2Comments  路  Source: elastic/curator

How can we run a delete on both --prefix .marvel- and --prefix .logstash- in one command?

Trying:

curator delete --older-than 60 --prefix .marvel- --prefix .logstash-

Does not find any indexes.

question

Most helpful comment

Multiple prefixes is not supported. However, regular expressions for --prefix _are_ supported:

$ curator -n delete --older-than 10 --prefix '(?:logstash-|.marvel-)'
2014-10-27 11:20:31,116 INFO      Job starting...
2014-10-27 11:20:31,117 INFO      DRY RUN MODE.  No changes will be made.
2014-10-27 11:20:31,120 INFO      DRY RUN: Deleting indices...
2014-10-27 11:20:31,131 INFO      DRY RUN: of delete_index operation on .marvel-2014.10.13
2014-10-27 11:20:31,131 INFO      DRY RUN: of delete_index operation on .marvel-2014.10.14
2014-10-27 11:20:31,131 INFO      DRY RUN: of delete_index operation on .marvel-2014.10.15
2014-10-27 11:20:31,131 INFO      DRY RUN: of delete_index operation on .marvel-2014.10.16
2014-10-27 11:20:31,131 INFO      DRY RUN: of delete_index operation on .marvel-2014.10.17
2014-10-27 11:20:31,131 INFO      .marvel-2014.10.18 is within the threshold period (10 days).
2014-10-27 11:20:31,132 INFO      .marvel-2014.10.19 is within the threshold period (10 days).
2014-10-27 11:20:31,132 INFO      .marvel-2014.10.20 is within the threshold period (10 days).
2014-10-27 11:20:31,132 INFO      .marvel-2014.10.21 is within the threshold period (10 days).
2014-10-27 11:20:31,132 INFO      .marvel-2014.10.22 is within the threshold period (10 days).
2014-10-27 11:20:31,132 INFO      .marvel-2014.10.23 is within the threshold period (10 days).
2014-10-27 11:20:31,132 INFO      .marvel-2014.10.24 is within the threshold period (10 days).
2014-10-27 11:20:31,132 INFO      .marvel-2014.10.25 is within the threshold period (10 days).
2014-10-27 11:20:31,133 INFO      .marvel-2014.10.26 is within the threshold period (10 days).
2014-10-27 11:20:31,133 INFO      .marvel-2014.10.27 is within the threshold period (10 days).
2014-10-27 11:20:31,133 INFO      DRY RUN: of delete_index operation on logstash-2014.10.13
2014-10-27 11:20:31,133 INFO      DRY RUN: of delete_index operation on logstash-2014.10.14
2014-10-27 11:20:31,133 INFO      DRY RUN: of delete_index operation on logstash-2014.10.15
2014-10-27 11:20:31,133 INFO      DRY RUN: of delete_index operation on logstash-2014.10.16
2014-10-27 11:20:31,133 INFO      DRY RUN: of delete_index operation on logstash-2014.10.17
2014-10-27 11:20:31,134 INFO      logstash-2014.10.18 is within the threshold period (10 days).
2014-10-27 11:20:31,134 INFO      logstash-2014.10.19 is within the threshold period (10 days).
2014-10-27 11:20:31,134 INFO      logstash-2014.10.20 is within the threshold period (10 days).
2014-10-27 11:20:31,134 INFO      logstash-2014.10.21 is within the threshold period (10 days).
2014-10-27 11:20:31,134 INFO      logstash-2014.10.22 is within the threshold period (10 days).
2014-10-27 11:20:31,134 INFO      logstash-2014.10.23 is within the threshold period (10 days).
2014-10-27 11:20:31,134 INFO      logstash-2014.10.24 is within the threshold period (10 days).
2014-10-27 11:20:31,135 INFO      logstash-2014.10.25 is within the threshold period (10 days).
2014-10-27 11:20:31,135 INFO      logstash-2014.10.26 is within the threshold period (10 days).
2014-10-27 11:20:31,135 INFO      logstash-2014.10.27 is within the threshold period (10 days).
2014-10-27 11:20:31,135 INFO      DRY RUN: Speficied indices deleted.
2014-10-27 11:20:31,135 INFO      Done in 0:00:00.051619.

So you can accomplish this with --prefix '(?:logstash-|.marvel-)' which has a logical OR between logstash- and .marvel-.

If this is an acceptable answer, please go ahead and close the issue. I'll close it in a few days otherwise.

All 2 comments

Multiple prefixes is not supported. However, regular expressions for --prefix _are_ supported:

$ curator -n delete --older-than 10 --prefix '(?:logstash-|.marvel-)'
2014-10-27 11:20:31,116 INFO      Job starting...
2014-10-27 11:20:31,117 INFO      DRY RUN MODE.  No changes will be made.
2014-10-27 11:20:31,120 INFO      DRY RUN: Deleting indices...
2014-10-27 11:20:31,131 INFO      DRY RUN: of delete_index operation on .marvel-2014.10.13
2014-10-27 11:20:31,131 INFO      DRY RUN: of delete_index operation on .marvel-2014.10.14
2014-10-27 11:20:31,131 INFO      DRY RUN: of delete_index operation on .marvel-2014.10.15
2014-10-27 11:20:31,131 INFO      DRY RUN: of delete_index operation on .marvel-2014.10.16
2014-10-27 11:20:31,131 INFO      DRY RUN: of delete_index operation on .marvel-2014.10.17
2014-10-27 11:20:31,131 INFO      .marvel-2014.10.18 is within the threshold period (10 days).
2014-10-27 11:20:31,132 INFO      .marvel-2014.10.19 is within the threshold period (10 days).
2014-10-27 11:20:31,132 INFO      .marvel-2014.10.20 is within the threshold period (10 days).
2014-10-27 11:20:31,132 INFO      .marvel-2014.10.21 is within the threshold period (10 days).
2014-10-27 11:20:31,132 INFO      .marvel-2014.10.22 is within the threshold period (10 days).
2014-10-27 11:20:31,132 INFO      .marvel-2014.10.23 is within the threshold period (10 days).
2014-10-27 11:20:31,132 INFO      .marvel-2014.10.24 is within the threshold period (10 days).
2014-10-27 11:20:31,132 INFO      .marvel-2014.10.25 is within the threshold period (10 days).
2014-10-27 11:20:31,133 INFO      .marvel-2014.10.26 is within the threshold period (10 days).
2014-10-27 11:20:31,133 INFO      .marvel-2014.10.27 is within the threshold period (10 days).
2014-10-27 11:20:31,133 INFO      DRY RUN: of delete_index operation on logstash-2014.10.13
2014-10-27 11:20:31,133 INFO      DRY RUN: of delete_index operation on logstash-2014.10.14
2014-10-27 11:20:31,133 INFO      DRY RUN: of delete_index operation on logstash-2014.10.15
2014-10-27 11:20:31,133 INFO      DRY RUN: of delete_index operation on logstash-2014.10.16
2014-10-27 11:20:31,133 INFO      DRY RUN: of delete_index operation on logstash-2014.10.17
2014-10-27 11:20:31,134 INFO      logstash-2014.10.18 is within the threshold period (10 days).
2014-10-27 11:20:31,134 INFO      logstash-2014.10.19 is within the threshold period (10 days).
2014-10-27 11:20:31,134 INFO      logstash-2014.10.20 is within the threshold period (10 days).
2014-10-27 11:20:31,134 INFO      logstash-2014.10.21 is within the threshold period (10 days).
2014-10-27 11:20:31,134 INFO      logstash-2014.10.22 is within the threshold period (10 days).
2014-10-27 11:20:31,134 INFO      logstash-2014.10.23 is within the threshold period (10 days).
2014-10-27 11:20:31,134 INFO      logstash-2014.10.24 is within the threshold period (10 days).
2014-10-27 11:20:31,135 INFO      logstash-2014.10.25 is within the threshold period (10 days).
2014-10-27 11:20:31,135 INFO      logstash-2014.10.26 is within the threshold period (10 days).
2014-10-27 11:20:31,135 INFO      logstash-2014.10.27 is within the threshold period (10 days).
2014-10-27 11:20:31,135 INFO      DRY RUN: Speficied indices deleted.
2014-10-27 11:20:31,135 INFO      Done in 0:00:00.051619.

So you can accomplish this with --prefix '(?:logstash-|.marvel-)' which has a logical OR between logstash- and .marvel-.

If this is an acceptable answer, please go ahead and close the issue. I'll close it in a few days otherwise.

@untergeek Perfect, exactly what we needed. Thanks.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pickypg picture pickypg  路  10Comments

rolandjitsu picture rolandjitsu  路  10Comments

ppf2 picture ppf2  路  6Comments

ep4sh picture ep4sh  路  3Comments

myoung34 picture myoung34  路  7Comments