# Filebeats in kubernetes - how to export specific log file in a pod to logstash?

**URL:** <https://discuss.elastic.co/t/filebeats-in-kubernetes-how-to-export-specific-log-file-in-a-pod-to-logstash/132827>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [May 22, 2018, 1:06pm UTC](https://discuss.elastic.co/t/filebeats-in-kubernetes-how-to-export-specific-log-file-in-a-pod-to-logstash/132827 "2018-05-22T13:06:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sivakr](https://avatars.discourse-cdn.com/v4/letter/s/c6cbf5/32.png) [@sivakr](https://discuss.elastic.co/u/sivakr)\
**Post date:** [May 22, 2018, 1:06pm UTC](https://discuss.elastic.co/t/filebeats-in-kubernetes-how-to-export-specific-log-file-in-a-pod-to-logstash/132827/1 "2018-05-22T13:06:54Z")

</div>

I have few pods with label app1

I want to send some log files of those specific pods with custom tags to logstash.

Ex: /tmp/\*.log of all pods with label: app1 should be sent to logstash with tag envoy-access-log

I have filebeat config like this

```
  filebeat.autodiscover:
    providers:
      - type: kubernetes
        templates:
          - condition.contains:
              kubernetes.labels.app: app1
            config:
              prospectors:
                paths:
                   - /tmp/*.log
                tags: ["envoy-access-log"]

  logging.metrics.enabled: false
  output.logstash:
    hosts: ["logstash.monit:5044"]

```

But Its not working. How can I achieve this ?

---

<div class="post-metadata">

**Author:** ![jsoriano](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jsoriano/32/27920_2.png) [@jsoriano](https://discuss.elastic.co/u/jsoriano)\
**Post date:** [May 22, 2018, 3:05pm UTC](https://discuss.elastic.co/t/filebeats-in-kubernetes-how-to-export-specific-log-file-in-a-pod-to-logstash/132827/2 "2018-05-22T15:05:58Z")

</div>

I think there is a missing hyphen before `prospectors`. The `config` option has to contain a list of configurations, in your case it'd be something like:

```auto
  filebeat.autodiscover:
    providers:
      - type: kubernetes
        templates:
          - condition.contains:
              kubernetes.labels.app: app1
            config:
              - prospectors:
                  paths:
                     - /tmp/*.log
                  tags: ["envoy-access-log"]

  logging.metrics.enabled: false
  output.logstash:
    hosts: ["logstash.monit:5044"]

```

You can also use the docker prospector to collect container logs, take a look to the examples in the documentation: [https://www.elastic.co/guide/en/beats/filebeat/6.2/configuration-autodiscover.html](https://www.elastic.co/guide/en/beats/filebeat/6.2/configuration-autodiscover.html)

---

<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:** [June 19, 2018, 3:06pm UTC](https://discuss.elastic.co/t/filebeats-in-kubernetes-how-to-export-specific-log-file-in-a-pod-to-logstash/132827/3 "2018-06-19T15:06:08Z")

</div>

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