# Add fields to traefik module output

**URL:** https://discuss.elastic.co/t/add-fields-to-traefik-module-output/314740
**Category:** Beats
**Tags:** docker
**Created:** [September 20, 2022, 6:30am UTC](https://discuss.elastic.co/t/add-fields-to-traefik-module-output/314740 "2022-09-20T06:30:54Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![titiyoyo](https://avatars.discourse-cdn.com/v4/letter/t/e95f7d/32.png) [@titiyoyo](https://discuss.elastic.co/u/titiyoyo)
#### Post date: [September 20, 2022, 6:30am UTC](https://discuss.elastic.co/t/add-fields-to-traefik-module-output/314740/1 "2022-09-20T06:30:54Z")

</div>

Hello,

I'm trying to add fields to logs parsed by the traefik module but I can't get it to work.  
I tried various syntaxes without luck. By my understanding of the documenation, the following should be working... but isn't.  
What am I doing wrong ?

```auto
# filebeat.yml

filebeat.modules:
  - module: traefik
    access:
      enabled: true
      var.paths: ["/var/log/traefik/*"]
      input:
        processors:
        - add_fields:
          fields:
            type: traefik
        - add_fields:
          when:
            contains:
              message: test-twapi-nginx@docker
          fields:
            environment: test
        - add_fields:
          when:
            contains:
              message: staging-twapi-nginx@docker
          fields:
            environment: staging
        - add_fields:
          when:
            contains:
              message: preprod-twapi-nginx@docker
          fields:
            environment: preprod

```

---

<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: [October 18, 2022, 6:31am UTC](https://discuss.elastic.co/t/add-fields-to-traefik-module-output/314740/2 "2022-10-18T06:31:09Z")

</div>

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