Add Elasticsearch Curator Docker image

Kolla provides log aggregation, but no solution to set retention periods
for aggregated logs. It therefore accumulates log data indefinitely unless
a user manually intervenes. This change adds Elasticsearch Curator which
provides a mechanism for automating such retention periods [1].

[1] https://www.elastic.co/guide/en/elasticsearch/client/curator/current/about.html

The container contains cron to support running Curator periodically.

Change-Id: Ief2c554a64ef6cc971635d7e2a718f63c310fbf6
This commit is contained in:
Doug Szumski 2019-03-14 11:54:30 +00:00 committed by Marcin Juszkiewicz
parent 666531893c
commit 37de8920aa
5 changed files with 52 additions and 0 deletions

View File

@ -0,0 +1,40 @@
FROM {{ namespace }}/{{ image_prefix }}base:{{ tag }}
LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}"
{% block elasticsearch_curator_header %}{% endblock %}
{% import "macros.j2" as macros with context %}
{% if base_package_type == 'rpm' %}
{% set elasticsearch_curator_packages = [
'cronie',
'python3-pip',
] %}
{% elif base_package_type == 'deb' %}
{% set elasticsearch_curator_packages = [
'cron',
'python3-pip',
'python3-setuptools'
] %}
{% endif %}
{{ macros.install_packages(elasticsearch_curator_packages | customizable("packages")) }}
{{ macros.configure_user(name='elasticsearch') }}
{% set elasticsearch_curator_pip_packages = [
'elasticsearch-curator'
] %}
RUN {{ macros.install_pip(elasticsearch_curator_pip_packages | customizable("pip_packages"), constraints=false, pip_version="pip3") }} \
&& mkdir -p /etc/elasticsearch-curator \
&& chown -R elasticsearch: /etc/elasticsearch-curator
COPY extend_start.sh /usr/local/bin/kolla_extend_start
RUN chmod 755 /usr/local/bin/kolla_extend_start
{% block elasticsearch_curator_base_footer %}{% endblock %}
{% block footer %}{% endblock %}
# NOTE(dszumski): Cron runs as root but should be configured to launch Curator
# by the elasticsearch user.

View File

@ -0,0 +1,8 @@
#!/bin/bash
# NOTE(dszumski): Cron runs as root but should be configured to launch Curator
# by the elasticsearch user. Therefore this directory needs to be owned by
# the elasticsearch user.
if [[ ! -d "/var/log/kolla/elasticsearch" ]]; then
install -d -m 0755 -o elasticsearch -g elasticsearch /var/log/kolla/elasticsearch
fi

View File

@ -0,0 +1,4 @@
---
features:
- |
Adds Elasticsearch Curator for managing aggregated log data.