Simplify curator extension
This commit is contained in:
parent
4676f21ee8
commit
95272b72f4
|
@ -1,13 +1,17 @@
|
|||
FROM alpine:3.8
|
||||
FROM bitnami/elasticsearch-curator:5.8.1
|
||||
|
||||
ENV CURATOR_VERSION=5.8.1
|
||||
USER root
|
||||
|
||||
RUN apk --update add --no-cache tini python py-pip \
|
||||
&& pip install elasticsearch-curator==${CURATOR_VERSION}
|
||||
RUN install_packages cron && \
|
||||
echo \
|
||||
'* * * * *' \
|
||||
root \
|
||||
LC_ALL=C.UTF-8 LANG=C.UTF-8 \
|
||||
/opt/bitnami/python/bin/curator \
|
||||
--config=/usr/share/curator/config/curator.yml \
|
||||
/usr/share/curator/config/delete_log_files_curator.yml \
|
||||
'>/proc/1/fd/1' '2>/proc/1/fd/2' \
|
||||
>>/etc/crontab
|
||||
|
||||
COPY entrypoint.sh /
|
||||
|
||||
WORKDIR /usr/share/curator
|
||||
COPY config ./config
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
ENTRYPOINT ["cron"]
|
||||
CMD ["-f", "-L8"]
|
||||
|
|
|
@ -11,8 +11,10 @@ command line argument referencing the `curator-compose.yml` file:
|
|||
$ docker-compose -f docker-compose.yml -f extensions/curator/curator-compose.yml up
|
||||
```
|
||||
|
||||
This sample setup demonstrates how to run `curator` every minute using `cron`.
|
||||
|
||||
All configuration files are available in the `config/` directory.
|
||||
|
||||
## Documentation
|
||||
|
||||
https://github.com/elastic/curator
|
||||
https://www.elastic.co/guide/en/elasticsearch/client/curator/current/index.html
|
||||
|
|
|
@ -1,24 +1,12 @@
|
|||
---
|
||||
# Remember, leave a key empty if there is no value. None will be a string,
|
||||
# not a Python "NoneType"
|
||||
# Curator configuration
|
||||
# https://www.elastic.co/guide/en/elasticsearch/client/curator/current/configfile.html
|
||||
|
||||
client:
|
||||
hosts:
|
||||
- ${ELASTICSEARCH_HOST}
|
||||
- elasticsearch
|
||||
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: False
|
||||
http_auth: elastic:changeme
|
||||
|
||||
logging:
|
||||
loglevel: DEBUG
|
||||
logfile:
|
||||
loglevel: INFO
|
||||
logformat: default
|
||||
|
|
|
@ -2,10 +2,11 @@ actions:
|
|||
1:
|
||||
action: delete_indices
|
||||
description: >-
|
||||
Delete indices. Find which to delete by first limiting the list to logstash-
|
||||
prefixed indices. Then further filter those to prevent deletion of anything
|
||||
less than ${UNIT_COUNT} days old. Ignore the error if the filter does not result in an
|
||||
actionable list of indices (ignore_empty_list) and exit cleanly.
|
||||
Delete indices. Find which to delete by first limiting the list to
|
||||
logstash- prefixed indices. Then further filter those to prevent deletion
|
||||
of anything less than the number of days specified by unit_count.
|
||||
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
|
||||
disable_action: False
|
||||
|
@ -17,4 +18,4 @@ actions:
|
|||
source: creation_date
|
||||
direction: older
|
||||
unit: days
|
||||
unit_count: ${UNIT_COUNT}
|
||||
unit_count: 2
|
||||
|
|
|
@ -4,12 +4,16 @@ services:
|
|||
curator:
|
||||
build:
|
||||
context: extensions/curator/
|
||||
environment:
|
||||
ELASTICSEARCH_HOST: elasticsearch
|
||||
CRON: 0 0 * * *
|
||||
CONFIG_FILE: /usr/share/curator/config/curator.yml
|
||||
COMMAND: /usr/share/curator/config/delete_log_files_curator.yml
|
||||
UNIT_COUNT: 2
|
||||
init: true
|
||||
volumes:
|
||||
- type: bind
|
||||
source: ./extensions/curator/config/curator.yml
|
||||
target: /usr/share/curator/config/curator.yml
|
||||
read_only: true
|
||||
- type: bind
|
||||
source: ./extensions/curator/config/delete_log_files_curator.yml
|
||||
target: /usr/share/curator/config/delete_log_files_curator.yml
|
||||
read_only: true
|
||||
networks:
|
||||
- elk
|
||||
depends_on:
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
echo "$CRON /usr/bin/curator --config ${CONFIG_FILE} ${COMMAND}" >>/etc/crontabs/root
|
||||
|
||||
# https://github.com/krallin/tini/blob/master/README.md#subreaping
|
||||
tini -s -- crond -f -d 8 -l 8
|
Loading…
Reference in New Issue