Curator is deleting all snapshots

(Ashish Goel) #1

Hi there,

I am using ElasticSearch 1.5.0 and curator 3.2.3.
I recently created a script to be executed as daily cron job which deletes all snapshots older than a week. But when executed, it deletes each and every snapshot in my S3 repository.

Following is the code snippet used for this:
/usr/local/bin/curator --timeout 21600 delete snapshots --repository $RESPOSITORY_NAME $snapshot_delete_string
where RESPOSITORY_NAME is the name of the S3 repository I am using and snapshot_delete_string is of the format [--snapshot snapshot_name]+

The log for the last execution of this script is below:
2015-12-10 04:00:04,825 INFO Job starting: delete snapshots 2015-12-10 04:00:08,564 INFO Adding curator-20151203150012 from command-line argument 2015-12-10 04:00:08,564 INFO Adding curator-20151203180012 from command-line argument 2015-12-10 04:00:08,564 INFO Adding curator-20151203210011 from command-line argument 2015-12-10 04:00:08,564 INFO Deleting snapshot curator-20151203150012 2015-12-10 04:03:14,586 INFO Deleting snapshot curator-20151203180012 2015-12-10 04:05:54,822 INFO Deleting snapshot curator-20151203210011 2015-12-10 04:08:21,964 INFO Deleting snapshot curator-20151204000013 2015-12-10 04:10:57,958 INFO Deleting snapshot curator-20151204030013 2015-12-10 04:13:31,731 INFO Deleting snapshot curator-20151204060013 .......... and may other snapshots, skipped here 2015-12-10 05:17:07,989 INFO Deleting snapshot curator-20151210030012 2015-12-10 05:18:59,970 INFO Job completed successfully

Curator --snapshot option matching all snapshots
(David Pilato) #2

You did not set older than or newer than?

(Ashish Goel) #3

When I started coding this, I was not aware that those options could be used with "delete" also and not just "show". So, I was first using the --older-than option with show, getting the list of snapshots to be deleted and then deleting them using --snapshot <snapshot_name> option.

Will using these options directly with "delete" help?

(David Pilato) #4

If you don't tell curator what to delete, I guess it deletes all snapshots matching the name you gave.

(Ashish Goel) #5

I gave exact names to curator, no regex.
Please have another look at the log I provided earlier. It starts with stating the three snapshot names that were provided to it. But then goes on deleting all the snapshots in the repository.

(David Pilato) #6

You're right. Using --snapshot ignores all other parameters.

I'd open an issue in curator project.

(Ashish Goel) #7

I just changed my cleanup script to make use of --older-than option instead of --snapshot option and things started to work as expected. Only the intended snapshots are getting deleted. Thanks for pointing me in the right direction.

(system) #8