Public Repository

Last pushed: a month ago
Short Description
Docker Image based on official logstash image (v5.0.2-1). Configurable by confd. Ran by Supervisor.
Full Description

Docker Image based on official logstash image (v5.0.2-1), running logstash through Supervisor and configurable by confd

  • Based on official logstash image
  • Includes confd to configure services
  • Includes supervisor to ensure services are running.

In line with best practices, it is possible to map a directory containing logs from the host, to a directory inside the container through docker volumes.

ENV VARIABLES

LOGSTASH_CONF_INPUT

Inputs for logstash to use. It is possible to use multiple inputs.

Syntax:
file {  path => "/var/log/external/inputLog.log"  }

LOGSTASH_CONF_FILTER

Filters for logstash to use. It is possible to use multiple filters. If filters not required, don't include this variable at runtime.

LOGSTASH_CONF_OUTPUT

Outputs for logstash to use. It is possible to use multiple outputs. Output for elasticseach would also be included (if used).

Syntax:
file { path => "/var/log/external/output.log" }

SUPERVISOR_CONF

SUPERVISOR_CONF: which programs we want supervisor to run, in a JSON format that will map to a supervisor.conf format. A default value is set in the Dockerfile as follows, although this can be overridden.

Syntax:
{
    "programs": [{
        "program": "logstash",
        "command": "logstash -f /etc/logstash/logstash.conf ",
        "startsecs": "20",
        "autorestart": "true",
        "stdout_logfile": "/var/log/supervisor/logstash.log",
        "priority": "3"
    }]
}
Example Usage
 docker run -d --name="logstash" \
  -e LOGSTASH_CONF_INPUT='tcp { port => 5000 } file { path => "/var/log/external/inputLog.log" } ' \
  -e LOGSTASH_CONF_FILTER='' \
  -e LOGSTASH_CONF_OUTPUT='file { path => "/var/log/external/output.log" }' \
  -v /mnt/logs:/var/log/external \
 -p "5044:5000" \
 insightsoftware/logstash:1.2.0

Dockerfile

FROM logstash:5.0.2-1

MAINTAINER Hubble Infrastructure <hubble.infrastructure@insightsoftware.com>

ENV CONFD_VERSION 0.12.0-alpha3
ENV CONFD_SHA1 437524fe3334bd9d0424ed0ece265472e789d19e 
ENV SUPERVISOR_VERSION 3.0r1-1
ENV SUPERVISOR_CONF='{"programs": [{"program": "logstash", "command": "logstash -f /etc/logstash/logstash.conf ", "startsecs": "20", "autorestart": "true", "stdout_logfile": "/var/log/supervisor/logstash.log", "priority": "3"}]}'

#Install confd and Supervisor
RUN  wget  https://github.com/kelseyhightower/confd/releases/download/v$CONFD_VERSION/confd-$CONFD_VERSION-linux-amd64 -O /usr/local/bin/confd && \ 
chmod +x /usr/local/bin/confd && echo $CONFD_SHA1 /usr/local/bin/confd | sha1sum -c - && \
\
apt-get update && apt-get -y install supervisor=$SUPERVISOR_VERSION && mkdir -p /etc/supervisor/conf.d/ && apt-get clean 

#Configure confd
COPY ./confd /etc/confd

#Configure Supervisor
COPY ./supervisor /etc/supervisor


COPY entrypoint.sh /
RUN chmod +x /entrypoint.sh

#Entrypoint
ENTRYPOINT ["sh", "entrypoint.sh"]
Docker Pull Command
Owner
insightsoftware

Comments (0)