Merge "Add cronjob for elasticsearch indices cleanup"
This commit is contained in:
commit
c13be0d39d
|
@ -5,4 +5,5 @@ ENV DEBIAN_FRONTEND noninteractive
|
||||||
RUN apt-get -y install --no-install-recommends \
|
RUN apt-get -y install --no-install-recommends \
|
||||||
cron \
|
cron \
|
||||||
logrotate \
|
logrotate \
|
||||||
&& apt-get clean
|
&& apt-get clean \
|
||||||
|
&& pip install --no-cache-dir elasticsearch-curator=={{ elasticsearch_curator_version }}
|
||||||
|
|
|
@ -13,7 +13,28 @@ service:
|
||||||
command: /usr/share/elasticsearch/bin/elasticsearch
|
command: /usr/share/elasticsearch/bin/elasticsearch
|
||||||
files:
|
files:
|
||||||
- elasticsearch.yml
|
- elasticsearch.yml
|
||||||
|
- name: cron
|
||||||
|
image: cron
|
||||||
|
probes:
|
||||||
|
readiness: "true"
|
||||||
|
liveness: "true"
|
||||||
|
daemon:
|
||||||
|
command: cron -f
|
||||||
|
files:
|
||||||
|
- es-curator-config
|
||||||
|
- es-curator-action-delete-indice
|
||||||
|
- es-curator-cronjob
|
||||||
files:
|
files:
|
||||||
elasticsearch.yml:
|
elasticsearch.yml:
|
||||||
path: /usr/share/elasticsearch/config/elasticsearch.yml
|
path: /usr/share/elasticsearch/config/elasticsearch.yml
|
||||||
content: elasticsearch.yml.j2
|
content: elasticsearch.yml.j2
|
||||||
|
es-curator-config:
|
||||||
|
path: /etc/curator/curator.yaml
|
||||||
|
content: curator.yaml.j2
|
||||||
|
es-curator-action-delete-indice:
|
||||||
|
path: /etc/curator/action-delete-indice.yaml
|
||||||
|
content: curator-action-delete-indice.yaml.j2
|
||||||
|
es-curator-cronjob:
|
||||||
|
path: /etc/cron.d/curator
|
||||||
|
content: curator-cronjob
|
||||||
|
perm: "0644"
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
---
|
||||||
|
# Remember, leave a key empty if there is no value. None will be a string,
|
||||||
|
# not a Python "NoneType"
|
||||||
|
actions:
|
||||||
|
1:
|
||||||
|
action: delete_indices
|
||||||
|
description: >-
|
||||||
|
Delete indices older than {{ elasticsearch_retention_period }} days
|
||||||
|
(based on index name), for 'log-' prefixed indices. Ignore the error
|
||||||
|
if the filter does not result in an actionable list of indices
|
||||||
|
(ignore_empty_list) and exit cleanly.
|
||||||
|
options:
|
||||||
|
ignore_empty_list: True
|
||||||
|
timeout_override:
|
||||||
|
continue_if_exception: False
|
||||||
|
disable_action: False
|
||||||
|
filters:
|
||||||
|
- filtertype: pattern
|
||||||
|
kind: prefix
|
||||||
|
value: log-
|
||||||
|
exclude:
|
||||||
|
- filtertype: age
|
||||||
|
source: name
|
||||||
|
direction: older
|
||||||
|
timestring: '%Y.%m.%d'
|
||||||
|
unit: days
|
||||||
|
unit_count: {{ elasticsearch_retention_period }}
|
||||||
|
exclude:
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
@daily root curator --config /etc/curator/curator.yaml /etc/curator/action-delete-indice.yaml
|
|
@ -0,0 +1,13 @@
|
||||||
|
---
|
||||||
|
# Remember, leave a key empty if there is no value. None will be a string,
|
||||||
|
# not a Python "NoneType"
|
||||||
|
client:
|
||||||
|
hosts:
|
||||||
|
- localhost
|
||||||
|
port: {{ elasticsearch_port }}
|
||||||
|
url_prefix:
|
||||||
|
use_ssl: False
|
||||||
|
certificate:
|
||||||
|
ssl_no_validate: False
|
||||||
|
timeout: 30
|
||||||
|
master_only: True
|
|
@ -1,6 +1,7 @@
|
||||||
configs:
|
configs:
|
||||||
elasticsearch_port: 9200
|
elasticsearch_port: 9200
|
||||||
elasticsearch_cluster_port: 9300
|
elasticsearch_cluster_port: 9300
|
||||||
|
elasticsearch_retention_period: 30
|
||||||
kibana_port: 5601
|
kibana_port: 5601
|
||||||
heka_max_procs: 2
|
heka_max_procs: 2
|
||||||
heka_service_pattern: "^k8s_(.-)%..*"
|
heka_service_pattern: "^k8s_(.-)%..*"
|
||||||
|
@ -24,3 +25,4 @@ versions:
|
||||||
grafana_version: "3.0.3-1463994644"
|
grafana_version: "3.0.3-1463994644"
|
||||||
elasticsearch_version: "2.4.0"
|
elasticsearch_version: "2.4.0"
|
||||||
kibana_version: "4.6.1"
|
kibana_version: "4.6.1"
|
||||||
|
elasticsearch_curator_version: "4.1.0"
|
||||||
|
|
Loading…
Reference in New Issue