# Tag logs files from different directories

**URL:** https://discuss.elastic.co/t/tag-logs-files-from-different-directories/266066
**Category:** Beats
**Tags:** filebeat
**Created:** [March 3, 2021, 7:49am UTC](https://discuss.elastic.co/t/tag-logs-files-from-different-directories/266066 "2021-03-03T07:49:03Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Warren\_Hansen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warren_hansen/32/84863_2.png) [@Warren\_Hansen](https://discuss.elastic.co/u/Warren_Hansen)
#### Post date: [March 3, 2021, 7:49am UTC](https://discuss.elastic.co/t/tag-logs-files-from-different-directories/266066/1 "2021-03-03T07:49:03Z")

</div>

Hi,

I have the same kind of log file that uses the same grok patterns to match, however they are in different folders and I want to tag them accordingly. How would I go about it?

Would something like this work:

```auto
    filebeat.inputs:
    - type: log
      enabled: true

      paths:
        - /opt/IBM/WebSphere/server_one/SystemOut.log
      tags: ["server_one"]
        
      paths:
        - /opt/IBM/WebSphere/server_two/SystemOut.log
      tags: ["server_two"]

```

---

<div class="post-metadata">

### Author: ![mtojek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mtojek/32/63863_2.png) [@mtojek](https://discuss.elastic.co/u/mtojek)
#### Post date: [March 3, 2021, 10:45am UTC](https://discuss.elastic.co/t/tag-logs-files-from-different-directories/266066/2 "2021-03-03T10:45:32Z")

</div>

Did you try to split them into multiple `type: log` entries? Your configuration seems to be incorrect as `paths` and `tags` are getting overwritten (YAML format).

---

<div class="post-metadata">

### Author: ![Warren\_Hansen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warren_hansen/32/84863_2.png) [@Warren\_Hansen](https://discuss.elastic.co/u/Warren_Hansen)
#### Post date: [March 3, 2021, 11:59am UTC](https://discuss.elastic.co/t/tag-logs-files-from-different-directories/266066/3 "2021-03-03T11:59:58Z")

</div>

Ok, so more like this:

```auto
    filebeat.inputs:
    - type: log
      enabled: true

      paths:
        - /opt/IBM/WebSphere/server_one/SystemOut.log
      tags: ["server_one"]

    - type: log
      enabled: true        
      paths:
        - /opt/IBM/WebSphere/server_two/SystemOut.log
      tags: ["server_two"]

```

---

<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: [March 31, 2021, 2:00pm UTC](https://discuss.elastic.co/t/tag-logs-files-from-different-directories/266066/4 "2021-03-31T14:00:42Z")

</div>

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