Add Curator extension (#297)
This commit is contained in:
parent
5cedd31d44
commit
1ac84fbea7
|
@ -0,0 +1,13 @@
|
||||||
|
FROM alpine:3.8
|
||||||
|
|
||||||
|
ENV CURATOR_VERSION=5.5.4
|
||||||
|
|
||||||
|
RUN apk --update add --no-cache tini python py-pip \
|
||||||
|
&& pip install elasticsearch-curator==${CURATOR_VERSION}
|
||||||
|
|
||||||
|
COPY entrypoint.sh /
|
||||||
|
|
||||||
|
WORKDIR /usr/share/curator
|
||||||
|
COPY config ./config
|
||||||
|
|
||||||
|
ENTRYPOINT ["/entrypoint.sh"]
|
|
@ -0,0 +1,18 @@
|
||||||
|
# Curator
|
||||||
|
|
||||||
|
Elasticsearch Curator helps you curate or manage your indices.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
If you want to include the Curator extension, run Docker Compose from the root of the repository with an additional
|
||||||
|
command line argument referencing the `curator-compose.yml` file:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker-compose -f docker-compose.yml -f extensions/curator/curator-compose.yml up
|
||||||
|
```
|
||||||
|
|
||||||
|
All configuration files are available in the `config/` directory.
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
|
||||||
|
https://github.com/elastic/curator
|
|
@ -0,0 +1,24 @@
|
||||||
|
---
|
||||||
|
# Remember, leave a key empty if there is no value. None will be a string,
|
||||||
|
# not a Python "NoneType"
|
||||||
|
client:
|
||||||
|
hosts:
|
||||||
|
- ${ELASTICSEARCH_HOST}
|
||||||
|
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
|
||||||
|
|
||||||
|
logging:
|
||||||
|
loglevel: DEBUG
|
||||||
|
logfile: /usr/share/curator/curator.log
|
||||||
|
logformat: default
|
|
@ -0,0 +1,20 @@
|
||||||
|
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.
|
||||||
|
options:
|
||||||
|
ignore_empty_list: True
|
||||||
|
disable_action: False
|
||||||
|
filters:
|
||||||
|
- filtertype: pattern
|
||||||
|
kind: prefix
|
||||||
|
value: logstash-
|
||||||
|
- filtertype: age
|
||||||
|
source: creation_date
|
||||||
|
direction: older
|
||||||
|
unit: days
|
||||||
|
unit_count: ${UNIT_COUNT}
|
|
@ -0,0 +1,18 @@
|
||||||
|
version: '2'
|
||||||
|
|
||||||
|
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
|
||||||
|
networks:
|
||||||
|
- elk
|
||||||
|
depends_on:
|
||||||
|
- elasticsearch
|
|
@ -0,0 +1,6 @@
|
||||||
|
#!/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