# Filebeat - How to tag multiple log files in kubernetes pod?

**URL:** <https://discuss.elastic.co/t/filebeat-how-to-tag-multiple-log-files-in-kubernetes-pod/133266>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [May 25, 2018, 6:42am UTC](https://discuss.elastic.co/t/filebeat-how-to-tag-multiple-log-files-in-kubernetes-pod/133266 "2018-05-25T06:42:12Z")\
**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 25, 2018, 6:42am UTC](https://discuss.elastic.co/t/filebeat-how-to-tag-multiple-log-files-in-kubernetes-pod/133266/1 "2018-05-25T06:42:12Z")

</div>

I have a pod which writes multiple log files (in different format) like

1. /var/log/custom1.log
2. /var/log/custom2.log

And the pod has label: payment

Now how do I create a Filebeat DeamonSet which looks for pod with `label: payment` and ships the `custom1.log` with tag `format_1` and `custom2.log` with tag `format_2` to Logstash

And since pod's are ephemeral it should ship logs even if new pods are added.

It would be really helpful if I get a Filebeat configuration for the above requirement.

Thanks

---

<div class="post-metadata">

**Author:** ![steffens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/steffens/32/79630_2.png) [@steffens](https://discuss.elastic.co/u/steffens)\
**Post date:** [May 28, 2018, 9:50am UTC](https://discuss.elastic.co/t/filebeat-how-to-tag-multiple-log-files-in-kubernetes-pod/133266/2 "2018-05-28T09:50:37Z")

</div>

You can find [kubernetes deployment samples](https://github.com/elastic/beats/tree/master/deploy/kubernetes) in the beats repository.

For filebeat custom modules and inputs can be configured by adding your own input configurations to the filebeat `inputs.d` subdirectory (moundPath: `/usr/share/filebeat/inputs.d`).

Question is: where exactly does the pod write these files too? Are you using shared volumes? As filebeat is running as a DaemonSet it needs to know the locations to pick up the files from + the location must be mounted into the filebeat container.

For example the ConfigMap configures the [docker log collector](https://github.com/elastic/beats/blob/master/deploy/kubernetes/filebeat/filebeat-configmap.yaml#L34). For the input to work, the `/var/lib/docker/containers` directory [is mounted](https://github.com/elastic/beats/blob/master/deploy/kubernetes/filebeat/filebeat-daemonset.yaml#L56) by the DaemonSet.

Using Autodiscovery, you can use container labels to configure collection and additional meta data to be added to the collected events. The [docs](https://www.elastic.co/guide/en/beats/filebeat/current/configuration-autodiscover.html#configuration-autodiscover) contain some samples.

---

<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 25, 2018, 9:50am UTC](https://discuss.elastic.co/t/filebeat-how-to-tag-multiple-log-files-in-kubernetes-pod/133266/3 "2018-06-25T09:50:43Z")

</div>

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