Skip to content

Instantly share code, notes, and snippets.

@untergeek
Created July 15, 2014 23:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save untergeek/377799cfdc396edb34c3 to your computer and use it in GitHub Desktop.
Save untergeek/377799cfdc396edb34c3 to your computer and use it in GitHub Desktop.
Curator with python strftime datestamp support
buh@BigMini (06:12 PM) [~/GIT/curator/curator] $ curl -XPUT 'http://localhost:9200/logstash-20140710/'
{"acknowledged":true}
buh@BigMini (06:12 PM) [~/GIT/curator/curator] $ ./curator.py delete --older-than 4 --timestring %Y%m%d
2014-07-15T18:12:46.382 INFO main:671 Job starting...
2014-07-15T18:12:46.383 INFO _new_conn:258 Starting new HTTP connection (1): localhost
2014-07-15T18:12:46.384 INFO log_request_success:49 GET http://localhost:9200/ [status:200 request:0.002s]
2014-07-15T18:12:46.384 INFO command_loop:565 Beginning DELETE operations...
2014-07-15T18:12:46.387 INFO log_request_success:49 GET http://localhost:9200/logstash-*/_settings?expand_wildcards=closed [status:200 request:0.002s]
2014-07-15T18:12:46.391 ERROR find_expired_data:325 Could not find a valid timestamp for logstash-2014.07.10 with timestring %Y%m%d
2014-07-15T18:12:46.391 ERROR find_expired_data:325 Could not find a valid timestamp for logstash-2014.07.11 with timestring %Y%m%d
2014-07-15T18:12:46.391 ERROR find_expired_data:325 Could not find a valid timestamp for logstash-2014.07.12 with timestring %Y%m%d
2014-07-15T18:12:46.391 ERROR find_expired_data:325 Could not find a valid timestamp for logstash-2014.07.13 with timestring %Y%m%d
2014-07-15T18:12:46.391 ERROR find_expired_data:325 Could not find a valid timestamp for logstash-2014.07.14 with timestring %Y%m%d
2014-07-15T18:12:46.391 ERROR find_expired_data:325 Could not find a valid timestamp for logstash-2014.07.15 with timestring %Y%m%d
2014-07-15T18:12:46.391 INFO command_loop:592 Attempting to delete index logstash-20140710 because it is 2 days, 0:00:00 older than cutoff.
2014-07-15T18:12:46.467 INFO log_request_success:49 DELETE http://localhost:9200/logstash-20140710 [status:200 request:0.075s]
2014-07-15T18:12:46.467 INFO command_loop:602 logstash-20140710: Successfully deleted.
2014-07-15T18:12:46.467 INFO command_loop:607 DELETE index operations completed.
2014-07-15T18:12:46.467 INFO main:698 Done in 0:00:00.098688.
@untergeek
Copy link
Author

Create atypical index name (no separator between Year Month and Day) and delete it!

@jordansissel
Copy link

Curious, what about using 'logstash-%Y%m%d' as the index name instead of specifying specifically just the timestring?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment