项目作者: anjia0532

项目描述 :
docker images for elasticsearch curator
高级语言: Dockerfile
项目地址: git://github.com/anjia0532/docker-curator.git
创建时间: 2017-08-18T01:35:22Z
项目社区:https://github.com/anjia0532/docker-curator

开源协议:

下载


Curator in docker

This is dockerized version of elasticsearch curator,tool to manage time-based indices.

the docker image for curator baseon the python:3.6-alpine(this image size only 30mb)

docker hub https://hub.docker.com/r/anjia0532/docker-curator/

Automated build Docker Pulls

Elastic Curator Official Image : untergeek/curator

My Curator Image : anjia0532/docker-curator

Curator is breaking into version dependent releases. Curator 6.x will work with Elasticsearch 6.x, Curator 7.x will work with Elasticsearch 7.x, Curator 8.x will work with Elasticsearch 8.x

Usage

docker-compose.yml

  1. version: '2'
  2. services:
  3. elasticsearch:
  4. image: docker.elastic.co/elasticsearch/elasticsearch:x.y.z
  5. ports:
  6. - 9200:9200/tcp
  7. #environment:
  8. # - http.host=0.0.0.0
  9. # - transport.host=127.0.0.1
  10. # Uncomment this section to have elasticsearch data loaded from a volume
  11. #volumes:
  12. # - /data/path/to/host/:/usr/share/elasticsearch/data
  13. # default version :latest
  14. # more information https://hub.docker.com/repository/docker/anjia0532/docker-curator/tags?page=1&ordering=last_updated
  15. curator:
  16. image: anjia0532/docker-curator
  17. environment:
  18. UNIT_COUNT: 10
  19. UNIT: days
  20. ES_HOST: elasticsearch
  21. depends_on:
  22. - elasticsearch
  23. volumes:
  24. - /config/path/to/host/:/config

action_file.yml(default)

env default value

  • UNIT_COUNT: 1
  • UNIT: months
  • ES_HOST: 127.0.0.1
  1. actions:
  2. 1:
  3. action: delete_indices
  4. description: >-
  5. Delete indices older than ${UNIT_COUNT:1} ${UNIT:months} (based on index name), for logstash-
  6. prefixed indices. Ignore the error if the filter does not result in an
  7. actionable list of indices (ignore_empty_list) and exit cleanly.
  8. options:
  9. ignore_empty_list: True
  10. timeout_override:
  11. continue_if_exception: True
  12. disable_action: False
  13. filters:
  14. - filtertype: pattern
  15. kind: prefix
  16. value: logstash-
  17. exclude:
  18. - filtertype: age
  19. source: name
  20. direction: older
  21. timestring: '%Y.%m.%d'
  22. unit: ${UNIT:months}
  23. unit_count: ${UNIT_COUNT:1}
  24. exclude:
  25. # 2:
  26. # action: delete_indices
  27. # description: >-
  28. # Delete indices older than ${UNIT_COUNT:1} ${UNIT:months} (based on index name), for filebeat-
  29. # prefixed indices. Ignore the error if the filter does not result in an
  30. # actionable list of indices (ignore_empty_list) and exit cleanly.
  31. # options:
  32. # ignore_empty_list: True
  33. # timeout_override:
  34. # continue_if_exception: True
  35. # disable_action: False
  36. # filters:
  37. # - filtertype: pattern
  38. # kind: prefix
  39. # value: filebeat-
  40. # exclude:
  41. # - filtertype: age
  42. # source: name
  43. # direction: older
  44. # timestring: '%Y.%m.%d'
  45. # unit: ${UNIT:months}
  46. # unit_count: ${UNIT_COUNT:1}
  47. # exclude:
  48. # 3:
  49. # action: delete_indices
  50. # description: >-
  51. # Delete indices older than ${UNIT_COUNT:1} ${UNIT:months} (based on index name), for heartbeat-
  52. # prefixed indices. Ignore the error if the filter does not result in an
  53. # actionable list of indices (ignore_empty_list) and exit cleanly.
  54. # options:
  55. # ignore_empty_list: True
  56. # timeout_override:
  57. # continue_if_exception: True
  58. # disable_action: False
  59. # filters:
  60. # - filtertype: pattern
  61. # kind: prefix
  62. # value: heartbeat-
  63. # exclude:
  64. # - filtertype: age
  65. # source: name
  66. # direction: older
  67. # timestring: '%Y.%m.%d'
  68. # unit: ${UNIT:months}
  69. # unit_count: ${UNIT_COUNT:1}
  70. # exclude:
  71. # 4:
  72. # action: delete_indices
  73. # description: >-
  74. # Delete indices older than ${UNIT_COUNT:1} ${UNIT:months} (based on index name), for heartbeat-
  75. # prefixed indices. Ignore the error if the filter does not result in an
  76. # actionable list of indices (ignore_empty_list) and exit cleanly.
  77. # options:
  78. # ignore_empty_list: True
  79. # timeout_override:
  80. # continue_if_exception: True
  81. # disable_action: False
  82. # filters:
  83. # - filtertype: pattern
  84. # kind: prefix
  85. # value: zipkin-
  86. # exclude:
  87. # - filtertype: age
  88. # source: name
  89. # direction: older
  90. # timestring: '%Y.%m.%d'
  91. # unit: ${UNIT:months}
  92. # unit_count: ${UNIT_COUNT:1}
  93. # exclude:

config_file.yml

env default value

  • USE_SSL: False
  • TIMEOUT: 120
  • MASTER_ONLY: True
  1. ---
  2. # Remember, leave a key empty if there is no value. None will be a string,
  3. # not a Python "NoneType"
  4. # old version 5.x-7.x
  5. client:
  6. hosts:
  7. - ${ES_HOST:127.0.0.1}
  8. port: 9200
  9. url_prefix:
  10. use_ssl: ${USE_SSL:False}
  11. certificate:
  12. client_cert:
  13. client_key:
  14. ssl_no_validate: False
  15. timeout: ${TIMEOUT:120}
  16. master_only: ${MASTER_ONLY:True}
  17. # curator 8.0+ version
  18. elasticsearch:
  19. client:
  20. hosts: ${ES_HOST}
  21. cloud_id:
  22. bearer_auth:
  23. opaque_id:
  24. request_timeout: ${TIMEOUT:120}
  25. http_compress:
  26. verify_certs: False
  27. ca_certs:
  28. client_cert:
  29. client_key:
  30. ssl_assert_hostname:
  31. ssl_assert_fingerprint:
  32. ssl_version:
  33. other_settings:
  34. master_only: ${MASTER_ONLY:True}
  35. skip_version_test:
  36. username:
  37. password:
  38. api_key:
  39. id:
  40. api_key:
  41. logging:
  42. loglevel: INFO
  43. logfile:
  44. logformat: default
  45. #blacklist: ['elasticsearch', 'urllib3']

cron job

every day at 0:00 am exec

  1. 0 0 * * * curator --config /config/config_file.yml /config/action_file.yml

Curator’s doc

Full reference is available at: https://www.elastic.co/guide/en/elasticsearch/client/curator/current/index.html