# Use filebeat added field for logstash conditions

**URL:** <https://discuss.elastic.co/t/use-filebeat-added-field-for-logstash-conditions/191799>\
**Category:** Logstash\
**Created:** [July 23, 2019, 11:29am UTC](https://discuss.elastic.co/t/use-filebeat-added-field-for-logstash-conditions/191799 "2019-07-23T11:29:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wellguys](https://avatars.discourse-cdn.com/v4/letter/w/8e7dd6/32.png) [@Wellguys](https://discuss.elastic.co/u/Wellguys)\
**Post date:** [July 23, 2019, 11:29am UTC](https://discuss.elastic.co/t/use-filebeat-added-field-for-logstash-conditions/191799/1 "2019-07-23T11:29:05Z")

</div>

Hello.

I'm having a problem understanding how exactly I am supposed to write the conditions in logstash with regards to fields I added to filebeat.  
Here is my filebeat inputs

```
filebeat.inputs:
- type: log
  enabled: true
  paths:
    - C:\inetpub\logs\LogFiles\*\*.log
  fields:
  iis: true

- type: log
  enabled: true
  paths:
    - C:\inetpub\logs\test\*.log
  fields:
    test: true

```

So what I am trying to do is to put each log in the correct index depending on the existing field iis or test.  
My first pipeline currently looks like this:

```
#INPUT#
input {
  beats {
    port => 5044
    ssl => false
  }
}

#OUTPUT#
output {
  if [source] == "/var/log/messages" {
    pipeline { send_to => syslog }
  }
  elseif [source] == "/var/log/firewalld" {
    pipeline { send_to => firewalld }
  }
  elseif [type] == "wineventlog" {
    pipeline {send_to => winlog }
  }
  elseif [iis] {
    pipeline { send_to => iis }
  }
  elseif [test] {
    pipeline { send_to => test }
  }
}

```

The problem can only come from this pipeline I tried with no condition and everything goes into an index with the fields.test or fields.iis field as expected.  
I tried to write [type] and [iis] as [fields][type] and [field][iis] but it doesn't work either.

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [July 23, 2019, 12:43pm UTC](https://discuss.elastic.co/t/use-filebeat-added-field-for-logstash-conditions/191799/2 "2019-07-23T12:43:45Z")

</div>

> [@Wellguys](#):
>
> I tried to write [type] and [iis] as [fields][type] and [field][iis] but it doesn't work either.

I would expect testing [fields][type] or [fields][iis] to work.

---

<div class="post-metadata">

**Author:** ![Wellguys](https://avatars.discourse-cdn.com/v4/letter/w/8e7dd6/32.png) [@Wellguys](https://discuss.elastic.co/u/Wellguys)\
**Post date:** [July 23, 2019, 2:07pm UTC](https://discuss.elastic.co/t/use-filebeat-added-field-for-logstash-conditions/191799/3 "2019-07-23T14:07:24Z")

</div>

And it does, the problem was from somewhere else but I must have solved it without realising it.

Thank you very much.

---

<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:** [August 20, 2019, 2:07pm UTC](https://discuss.elastic.co/t/use-filebeat-added-field-for-logstash-conditions/191799/4 "2019-08-20T14:07:29Z")

</div>

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