# How to properly launch filebeat in container?

**URL:** <https://discuss.elastic.co/t/how-to-properly-launch-filebeat-in-container/225984>\
**Category:** Beats\
**Tags:** docker, filebeat\
**Created:** [April 1, 2020, 6:26am UTC](https://discuss.elastic.co/t/how-to-properly-launch-filebeat-in-container/225984 "2020-04-01T06:26:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![voipp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/voipp/32/65447_2.png) [@voipp](https://discuss.elastic.co/u/voipp)\
**Post date:** [April 1, 2020, 6:26am UTC](https://discuss.elastic.co/t/how-to-properly-launch-filebeat-in-container/225984/1 "2020-04-01T06:26:39Z")

</div>

Hello!  
I launched filebeat in container like advised in this link: [www.elastic.co](https://www.elastic.co/guide/en/beats/filebeat/current/running-on-docker.html)  
But filebeat doesn't send my logs to remote host.

It seems the provided dockerfile is incorrect, entrypoint is absent. Is it?  
I modified it a little bit:

```
FROM docker.elastic.co/beats/filebeat:7.6.0
COPY filebeat.yml /usr/share/filebeat/filebeat.yml
USER root
RUN chown root:filebeat /usr/share/filebeat/filebeat.yml
RUN chmod go-w /usr/share/filebeat/filebeat.yml
USER filebeat

```

filebeat.yml:

```auto
###################### Filebeat Configuration #########################
#=========================== Filebeat inputs =============================
filebeat.inputs:
- type: log
  enabled: true
  paths:
    - /var/log/*.log
#==================== Elasticsearch template setting ==========================
setup.template.enabled: true
setup.template.name: "foo"
setup.template.pattern: "foo-*"
setup.template.overwrite: true

output.elasticsearch:
  hosts: '${ES_HOSTS:?Elasticsearch ip is not defined.}'
  index: "foo-%{[agent.version]}-%{+yyyy.MM.dd}"
  username: "filebeat"
  password: "filebeat"

```

Built the image, created sample logs and launched it:

```auto
docker run -e ES_HOSTS="*some_host:some_port*" -v "/var/logs/foo-service:/var/log" filebeat

```

But logs aren't processed, filebeat doesn't output anything.

What is wrong?  
Perhaps Dockerfile is incorrect?

Also, I have the following configs in filebeat.yml: _setup.template_. It performs index creation based on template name, would the index be automatically created?

---

<div class="post-metadata">

**Author:** ![ChrsMark](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chrsmark/32/55858_2.png) [@ChrsMark](https://discuss.elastic.co/u/ChrsMark)\
**Post date:** [April 1, 2020, 10:04am UTC](https://discuss.elastic.co/t/how-to-properly-launch-filebeat-in-container/225984/2 "2020-04-01T10:04:39Z")

</div>

Hi!

Could you make sure that the path you configure is valid?

This part

```auto
filebeat.inputs:
- type: log
  enabled: true
  paths:
    - /var/log/*.log

```

should match the log file you want to collect from for instance: `/var/log/foo.log`

Reference: [https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-input-log.html#input-paths](https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-input-log.html#input-paths)

Regards.

---

<div class="post-metadata">

**Author:** ![voipp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/voipp/32/65447_2.png) [@voipp](https://discuss.elastic.co/u/voipp)\
**Post date:** [April 1, 2020, 10:18am UTC](https://discuss.elastic.co/t/how-to-properly-launch-filebeat-in-container/225984/3 "2020-04-01T10:18:46Z")

</div>

I checked path. Its valid. I run _docker exec -it 123a bash_ and checked this folder, its full of logs

Could you please also answer other questions.

---

<div class="post-metadata">

**Author:** ![Mastana\_Guru](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mastana_guru/32/46127_2.png) [@Mastana\_Guru](https://discuss.elastic.co/u/Mastana_Guru)\
**Post date:** [April 2, 2020, 3:21pm UTC](https://discuss.elastic.co/t/how-to-properly-launch-filebeat-in-container/225984/4 "2020-04-02T15:21:00Z")

</div>

@vlopp, check if filebeat is connecting to ealsticsearch

docker exec -it filebeat ./filebeat test output

Raj

---

<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:** [April 30, 2020, 3:21pm UTC](https://discuss.elastic.co/t/how-to-properly-launch-filebeat-in-container/225984/5 "2020-04-30T15:21:01Z")

</div>

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