Deploy filebeat in docker using a custom Dockerfile with a entry script

Hello,
I am deploying my custom config filebeat using docker with the following docker file.
FROM docker.elastic.co/beats/filebeat:5.6.3
COPY filebeat.yml /usr/share/filebeat/filebeat.yml
USER root
RUN chown filebeat /usr/share/filebeat/filebeat.yml
RUN chmod go-w /usr/share/filebeat/filebeat.yml
COPY change_config.sh /opt/change_config.sh
ENTRYPOINT [ "/opt/change_config.sh" ]
USER filebeat

The /opt/change_config.sh changes the config file filebeat.yml, add a custom field with a uuid. I need the uuid to attach unique id to each run.

the docker compose creates the filebeat container but the filebeat is not harvesting the log file. When I did a dockers logs on the container, I can see only the change_config.sh console logs and not of the filebeat logs.It seems the filebeat is actually not running.

Hi @vivekthangathurai, if you are only changing filebeat.yml it is recommended you do it like this: https://www.elastic.co/guide/en/beats/filebeat/6.1/running-on-docker.html (either mount or COPY).

You can then use environment variables to set the UUID, check: https://www.elastic.co/guide/en/beats/filebeat/6.1/using-environ-vars.html

@exekias Thank you ..I have been breaking my head. The second option worked.

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