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

**URL:** <https://discuss.elastic.co/t/exiting-missing-field-accessing-output-elasticsearch-index-source-command-line-flag/243791>\
**Category:** Beats\
**Tags:** docker, filebeat\
**Created:** [August 4, 2020, 10:49pm UTC](https://discuss.elastic.co/t/exiting-missing-field-accessing-output-elasticsearch-index-source-command-line-flag/243791 "2020-08-04T22:49:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![luado](https://avatars.discourse-cdn.com/v4/letter/l/a87d85/32.png) [@luado](https://discuss.elastic.co/u/luado)\
**Post date:** [August 4, 2020, 10:49pm UTC](https://discuss.elastic.co/t/exiting-missing-field-accessing-output-elasticsearch-index-source-command-line-flag/243791/1 "2020-08-04T22:49:05Z")

</div>

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:

```auto
    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.

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

```

---

<div class="post-metadata">

**Author:** ![luado](https://avatars.discourse-cdn.com/v4/letter/l/a87d85/32.png) [@luado](https://discuss.elastic.co/u/luado)\
**Post date:** [August 5, 2020, 6:59pm UTC](https://discuss.elastic.co/t/exiting-missing-field-accessing-output-elasticsearch-index-source-command-line-flag/243791/2 "2020-08-05T18:59:39Z")

</div>

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,

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 2, 2020, 8:59pm UTC](https://discuss.elastic.co/t/exiting-missing-field-accessing-output-elasticsearch-index-source-command-line-flag/243791/3 "2020-09-02T20:59:49Z")

</div>

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