Usage: curator [OPTIONS] ACTION_FILE
Curator for Elasticsearch indices.
See http://elastic.co/guide/en/elasticsearch/client/curator/current
Options:
--config PATH Path to configuration file. Default: ~/.curator/curator.yml
--dry-run Do not perform any changes.
--version Show the version and exit.
--help Show this message and exit.
複製代碼
# Remember, leave a key empty if there is no value. None will be a string,# not a Python "NoneType"client: hosts: -127.0.0.1 port:9200 url_prefix: use_ssl:False certificate: client_cert: client_key: aws_key: aws_secret_key: aws_region: ssl_no_validate:False http_auth: timeout:30 master_only:Falselogging: loglevel:INFO logfile: logformat:default blacklist:['elasticsearch','urllib3']複製代碼
delete_indices.yml配置(刪除3天以上的索引配置)curl
# Remember, leave a key empty if there is no value. None will be a string,# not a Python "NoneType"## Also remember that all examples have 'disable_action' set to True. If you# want to use this action as a template, be sure to set this to False after# copying it.actions:1: action:delete_indices description:>-Deleteindicesolderthan3days(basedonindexname),fortest-prefixedindices.Ignoretheerrorifthefilterdoesnotresultinanactionablelistofindices(ignore_empty_list)andexitcleanly. options: ignore_empty_list:True timeout_override: continue_if_exception:False disable_action:False filters: - filtertype:pattern kind:prefix value:test- exclude: - filtertype:age source:name direction:older timestring:'%Y.%m.%d' unit:days unit_count:3 exclude:複製代碼
ubuntu@localhost:/etc/elasticsearch_curator$ curator --config /etc/elasticsearch_curator/curator.yml /etc/elasticsearch_curator/delete_indices.yml
2018-12-20 14:22:06,854 INFO Preparing Action ID: 1, "delete_indices"
2018-12-20 14:22:06,863 INFO Trying Action ID: 1, "delete_indices": Delete indices older than 3 days (based on index name)
2018-12-20 14:22:06,965 INFO Deleting selected indices: ['test-2018.12.10']
2018-12-20 14:22:06,965 INFO ---deleting index test-2018.12.10
2018-12-20 14:22:07,262 INFO Action ID: 1, "delete_indices" completed.
2018-12-20 14:22:07,262 INFO Job completed.
複製代碼