Exiting: missing field accessing 'output.elasticsearch.index' (source:'command line flag')

I have made a custom beat. It runs fine. When I run it from inside a docker container it complains that I'm trying to change the index.
My Dockerfile goes like this:

    FROM ubuntu
MAINTAINER Luis Eduardo Pessoa

ARG ${ip:-"200.143.193.54"}
ARG ${porta:-"8443"}
ARG ${dataInicio:-"2020-01-07"}
ARG ${dataFim:-"2020-01-07"}
ARG ${tipoEquipamento:-"SRC"}
ARG ${versao:-"2"}
ARG ${nivel:-"0"}
ARG ${instituicao:-"RJ"}
ADD . .
RUN echo ${porta}
RUN apt-get update && \
    apt-get install -y wget git
RUN wget https://storage.googleapis.com/golang/go1.14.4.linux-amd64.tar.gz
RUN tar -zxvf go1.14.*.linux-amd64.tar.gz -C /usr/local
RUN mkdir /go

ENV GOROOT /usr/local/go
ENV GOPATH $HOME/go
ENV PATH $PATH:$GOROOT/bin:$GOPATH/bin

RUN echo $PATH
RUN go get -u -d github.com/magefile/mage
RUN cd $GOPATH/src/github.com/magefile/mage && \
    go run bootstrap.go
RUN apt-get install -y python3-venv
RUN apt-get install -y build-essential
RUN cd /coletorbeat && chmod go-w coletorbeat.yml

CMD now=$( date '+%F_%H:%M:%S' ) && cd /coletorbeat && ./coletorbeat -E 'coletorbeat.ip=${ip}' -E 'coletorbeat.porta=${porta}' -E 'coletorbeat.dataInicio=${dataInicio}' -E 'coletorbeat.dataFim=${dataFim}' -E 'coletorbeat.tipoEquipamento=${tipoEquipamento}' -E 'coletorbeat.versao=${versao}' -E 'coletorbeat.nivel=${nivel}' -E 'coletorbeat.instituicao=${instituicao}' -E 'output.elasticsearch.index=collectorbeat-${instituicao}-${tipoEquipamento}-now-${ip}'

Below is my output.elasticsearch.index. As defined in the beat.yml file. I've hunted after uncorrect indentations and could find none. All indentations in the file do respect the double space indentation.

output.elasticsearch:
  # Array of hosts to connect to.
  hosts: ["10.253.253.158:9200"]
  index: "collectorbeat-${coletorbeat.nomeInstituicao}-${coletorbeat.tipoEquipamento}-%{+dd.MM.yyyy}"

Solved it running the beat from a script I made, that uses golang exec.Command to call the beat.
So my Dockerfile CMD line call a script that call the beat. All works like this.

The script itself I built into a binary,

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