# Custom field not appearing in o/p for IIS.yml module

**URL:** <https://discuss.elastic.co/t/custom-field-not-appearing-in-o-p-for-iis-yml-module/227663>\
**Category:** Beats\
**Tags:** beats-module, windows, filebeat\
**Created:** [April 12, 2020, 9:57am UTC](https://discuss.elastic.co/t/custom-field-not-appearing-in-o-p-for-iis-yml-module/227663 "2020-04-12T09:57:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![imti283](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/imti283/32/63960_2.png) [@imti283](https://discuss.elastic.co/u/imti283)\
**Post date:** [April 12, 2020, 9:57am UTC](https://discuss.elastic.co/t/custom-field-not-appearing-in-o-p-for-iis-yml-module/227663/1 "2020-04-12T09:57:57Z")

</div>

Hi,

I am using IIS module in filebeat to ship logs to my logstash. As, I have multiple environment and sites, i am trying to add custom field in iis.yml module to make my logstash work easy and create index based on enviroment. Below is my iis.yml file -

```auto
# Module: iis
# Docs: https://www.elastic.co/guide/en/beats/filebeat/7.6/filebeat-module-iis.html

- module: iis
  # Access logs
  access:
    enabled: true

    # Set custom paths for the log files. If left empty,
    # Filebeat will choose the paths depending on your OS.
    var.paths: ["D:/Logs/W3SVC1/*.log"]
    exclude_line: ['^.*ELB-HealthChecker.*$']
    fields: {log_type: iisnonpro}

  # Error logs
  error:
    enabled: false

    # Set custom paths for the log files. If left empty,
    # Filebeat will choose the paths depending on your OS.
    #var.paths:

```

**But its not adding the custom field _iisnonpro_, while i output filebeat -**

---

<div class="post-metadata">

**Author:** ![Kaiyan\_Sheng](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kaiyan_sheng/32/38247_2.png) [@Kaiyan\_Sheng](https://discuss.elastic.co/u/Kaiyan_Sheng)\
**Post date:** [April 13, 2020, 11:04pm UTC](https://discuss.elastic.co/t/custom-field-not-appearing-in-o-p-for-iis-yml-module/227663/2 "2020-04-13T23:04:35Z")

</div>

Hi! I tried with similar config like below and also didn't see the custom field `log_type`.

```auto
- module: iis
  # Access logs
  access:
    enabled: true
    var.paths: ["D:/Logs/W3SVC1/*.log"]
    exclude_line: ['^.*ELB-HealthChecker.*$']
    fields:
      log_type: iisnonpro

  # Error logs
  error:
    enabled: false

```

I also gave [Custom Fields with Module Config](https://discuss.elastic.co/t/custom-fields-with-module-config/174601/2) a try, no luck. I will look into this a bit more and get back to you. Thank you for posting here!

---

<div class="post-metadata">

**Author:** ![Kaiyan\_Sheng](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kaiyan_sheng/32/38247_2.png) [@Kaiyan\_Sheng](https://discuss.elastic.co/u/Kaiyan_Sheng)\
**Post date:** [April 14, 2020, 2:34pm UTC](https://discuss.elastic.co/t/custom-field-not-appearing-in-o-p-for-iis-yml-module/227663/3 "2020-04-14T14:34:02Z")

</div>

@imti283 Just found the problem! The correct syntax is

```auto
- module: system
  # Syslog
  syslog:
    enabled: true
    input:
      fields:
        testfield: iisnonpro

```

I used system Filebeat module for testing and the custom field I got from Filebeat looks like this:

 ![Screen Shot 2020-04-14 at 8.32.22 AM](https://us1.discourse-cdn.com/elastic/original/3X/c/0/c0d4e5b9e9c998b982ae8b23d575a6c880ba8273.png)

So in your case with iis module, the config should look like:

```auto
- module: iis
  # Access logs
  access:
    enabled: true

    # Set custom paths for the log files. If left empty,
    # Filebeat will choose the paths depending on your OS.
    var.paths: ["D:/Logs/W3SVC1/*.log"]
    exclude_line: ['^.*ELB-HealthChecker.*$']
    input:
      fields:
        log_type: iisnonpro

  # Error logs
  error:
    enabled: false

```

---

<div class="post-metadata">

**Author:** ![imti283](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/imti283/32/63960_2.png) [@imti283](https://discuss.elastic.co/u/imti283)\
**Post date:** [April 17, 2020, 11:38am UTC](https://discuss.elastic.co/t/custom-field-not-appearing-in-o-p-for-iis-yml-module/227663/4 "2020-04-17T11:38:30Z")

</div>

Thanks a lot @Kaiyan_Sheng . Will test quickly and come back.

Edit1: Yes it is working:-)

---

<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:** [May 15, 2020, 11:38am UTC](https://discuss.elastic.co/t/custom-field-not-appearing-in-o-p-for-iis-yml-module/227663/5 "2020-05-15T11:38:36Z")

</div>

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