# Unable to ship docker container logs using Filebeat

**URL:** <https://discuss.elastic.co/t/unable-to-ship-docker-container-logs-using-filebeat/287460>\
**Category:** Beats\
**Tags:** docker\
**Created:** [October 22, 2021, 7:58pm UTC](https://discuss.elastic.co/t/unable-to-ship-docker-container-logs-using-filebeat/287460 "2021-10-22T19:58:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Akanksha\_Pandey](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/akanksha_pandey/32/89539_2.png) [@Akanksha\_Pandey](https://discuss.elastic.co/u/Akanksha_Pandey)\
**Post date:** [October 22, 2021, 7:58pm UTC](https://discuss.elastic.co/t/unable-to-ship-docker-container-logs-using-filebeat/287460/1 "2021-10-22T19:58:51Z")

</div>

I'm using **Filebeat native version 7.10.0** to collect all the docker container logs located at `/var/lib/docker/containers/container-id/.json` . But unable to ship the logs. Below is my filebeat configuration file.

Anyone please help me!

```auto
filebeat.inputs:

# Each - is an input. Most options can be set at the input level, so
# you can use different inputs for various configurations.
# Below are the input specific configurations.

- type: log

  # Change to true to enable this input configuration.
  enabled: true

  # Paths that should be crawled and fetched. Glob based paths.
  paths:
    - /var/log/*.log

- type: container
  enabled: true
  paths:
    - '/var/lib/docker/containers/*/*.log'
json.message_key: log
json.keys_under_root: true
processors:
- add_docker_metadata: ~

filebeat.config.modules:
  # Glob pattern for configuration loading
  path: ${path.config}/modules.d/*.yml

  # Set to true to enable config reloading
  reload.enabled: false

  # Period on which files under path should be checked for changes
  #reload.period: 10s

# ======================= Elasticsearch template setting =======================

setup.template.settings:
  index.number_of_shards: 1
  #index.codec: best_compression
  #_source.enabled: false
setup.template.name: "system-1"
setup.template.pattern: "system-1-*"

setup.kibana:

  # Kibana Host
  # Scheme and port can be left out and will be set to the default (http and 5601)
  # In case you specify and additional path, the scheme is required: http://localhost:5601/path
  # IPv6 addresses should always be defined as: https://[2001:db8::1]:5601
  host: "host:5601"

  # Kibana Space ID
  # ID of the Kibana Space into which the dashboards should be loaded. By default,
  # the Default Space will be used.
  #space.id:

# =============================== Elastic Cloud ================================

# These settings simplify using Filebeat with the Elastic Cloud (https://cloud.elastic.co/).

# The cloud.id setting overwrites the `output.elasticsearch.hosts` and
# `setup.kibana.host` options.
# You can find the `cloud.id` in the Elastic Cloud web UI.
#cloud.id:

# The cloud.auth setting overwrites the `output.elasticsearch.username` and
# `output.elasticsearch.password` settings. The format is `<user>:<pass>`.
#cloud.auth:

# ================================== Outputs ===================================

# Configure what output to use when sending the data collected by the beat.

# ---------------------------- Elasticsearch Output ----------------------------
output.elasticsearch:
  # Array of hosts to connect to.
  hosts: ["host:9200"]

  indices:
    - index: "system-grafana-%{+yyyy.MM.dd}"
      when.or:
         - equals:
             container.image.name: grafana_grafana

    - index: "system-minio-%{+yyyy.MM.dd}"
      when.or:
        - equals:
             container.image.name: minio_minio
                                             
    - index: "system-adminer-%{+yyyy.MM.dd}"
      when.or:
         - equals:
             container.image.name: adminer

    - index: "system-%{+yyyy.MM.dd}"

  # Protocol - either `http` (default) or `https`.
  #protocol: "https"

  # Authentication credentials - either API key or username/password.
  #api_key: "id:api_key"
  username: "elastic"
  password: "changeme"
  #logging.json: true
  #logging.metrics.enabled: false

# ------------------------------ Logstash Output -------------------------------
#output.logstash:
  # The Logstash hosts
  #hosts: ["localhost:5044"]

  # Optional SSL. By default is off.
  # List of root certificates for HTTPS server verifications
  #ssl.certificate_authorities: ["/etc/pki/root/ca.pem"]

  # Certificate for SSL client authentication
  #ssl.certificate: "/etc/pki/client/cert.pem"

  # Client Certificate Key
  #ssl.key: "/etc/pki/client/cert.key"

# ================================= Processors =================================
processors:
  - add_host_metadata:
      when.not.contains.tags: forwarded
  - add_cloud_metadata: ~
  - add_docker_metadata: ~
  - add_kubernetes_metadata: ~
#migration.6_to_7.enabled: true
setup.ilm.enabled: false

```

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [October 26, 2021, 12:24am UTC](https://discuss.elastic.co/t/unable-to-ship-docker-container-logs-using-filebeat/287460/2 "2021-10-26T00:24:01Z")

</div>

Hi @Akanksha_Pandey

First this looks wrongly formatted...

> [@Akanksha\_Pandey](#):
>
> ```auto
> - type: container
> enabled: true
> paths:
> - '/var/lib/docker/containers/*/*.log'
> json.message_key: log <!-- Should be indented 
> json.keys_under_root: true <!-- Should be indented 
> 
> ```

Can you please post your filebeat startup logs?

Also does the user running filebeat have access to that those logs? How are you starting filebeat?

---

<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:** [November 23, 2021, 12:24am UTC](https://discuss.elastic.co/t/unable-to-ship-docker-container-logs-using-filebeat/287460/3 "2021-11-23T00:24:26Z")

</div>

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