How to make filebeat run inside the logstash container?

Using filebeat, you need to collect logs from the Logstash.
In this case, filebeat should be launched inside the logstash container at each of its (logstash containers) startups and collected logs from the Logstash.

There is a bash script that runs filebeat then logstash sequentially. But it does not start logstash.

metricbeat -e
status=$?
if [ $status -ne 0 ]; then
  echo "Failed to start Metricbeat: $status"
  exit $status
fi


filebeat -e
status=$?
if [ $status -ne 0 ]; then
  echo "Failed to start Filebeat: $status"
  exit $status
fi

# Start your service
logstash -e
status=$?
if [ $status -ne 0 ]; then
  echo "Failed to start docker-filebeat: $status"
  exit $status
fi

Dockerfile

FROM ubuntu:16.04

RUN apt-get update && apt-get install -y wget gnupg gnupg2 \
    bash
RUN wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | apt-key add -
RUN apt-get install apt-transport-https -y
RUN echo "deb https://artifacts.elastic.co/packages/oss-7.x/apt stable main" | tee -a /etc/apt/sources.list.d/elastic-7.x.list
RUN apt-get update && apt-get install filebeat metricbeat

COPY . .
COPY run.sh /run.sh

COPY filebeat.yml /etc/filebeat/config/filebeat.yml
COPY /_volumes/ /usr/share/filebeat/logs/

USER root

RUN chown -R root /etc/filebeat/
RUN chmod -R go-w /etc/filebeat/


ENTRYPOINT ["sh", "./run.sh"]

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.