# Question on Fields created in Filebeat and matched in Logstash Input

**URL:** <https://discuss.elastic.co/t/question-on-fields-created-in-filebeat-and-matched-in-logstash-input/95733>\
**Category:** Logstash\
**Created:** [August 3, 2017, 2:44pm UTC](https://discuss.elastic.co/t/question-on-fields-created-in-filebeat-and-matched-in-logstash-input/95733 "2017-08-03T14:44:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![shroh](https://avatars.discourse-cdn.com/v4/letter/s/74df32/32.png) [@shroh](https://discuss.elastic.co/u/shroh)\
**Post date:** [August 3, 2017, 2:44pm UTC](https://discuss.elastic.co/t/question-on-fields-created-in-filebeat-and-matched-in-logstash-input/95733/1 "2017-08-03T14:44:24Z")

</div>

This may be a theoretical question, I am trying to configure my filebeat to send the logs to logstash. Here is the config:

- input\_type: log  
paths:
  - /prod/logs/chassis/tomcat/app\*.log  
#- c:\programdata\elasticsearch\logs\*  
fields:  
index: app\_mon  
source: tomcat\_app  
aws\_region: coaf\_dev\_east

My question is , can we use the fields created in the filebeat.yml to filter out in the Logstash config input section?

For ex: in the above config, i have defined source : tomcat\_app , can i use the same field in the logstash input like below:

input {  
file {  
path =\> /prod/logs/chassis/tomcat/app\*.log  
source =\> tomcat\_app  
}

filter {

```
   if [source == tomcat_app]
      grok {

      {message => somegrokfilter}

       }

```

}

Output {

ES  
}

So is the field SOURCE in filebeat.yml and logstash config file are same? Do the fields work this way?

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [August 3, 2017, 5:32pm UTC](https://discuss.elastic.co/t/question-on-fields-created-in-filebeat-and-matched-in-logstash-input/95733/2 "2017-08-03T17:32:19Z")

</div>

> My question is , can we use the fields created in the filebeat.yml to filter out in the Logstash config input section?

Yes, of course.

> ```
> if [source == tomcat_app]
> 
> ```

The idea is correct but the syntax is wrong. See [Accessing event data and fields | Logstash Reference [8.11] | Elastic](https://www.elastic.co/guide/en/logstash/current/event-dependent-configuration.html).

---

<div class="post-metadata">

**Author:** ![shroh](https://avatars.discourse-cdn.com/v4/letter/s/74df32/32.png) [@shroh](https://discuss.elastic.co/u/shroh)\
**Post date:** [August 3, 2017, 5:49pm UTC](https://discuss.elastic.co/t/question-on-fields-created-in-filebeat-and-matched-in-logstash-input/95733/3 "2017-08-03T17:49:52Z")

</div>

Thanks Magnus. Found the correct syntax.

---

<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 31, 2017, 5:50pm UTC](https://discuss.elastic.co/t/question-on-fields-created-in-filebeat-and-matched-in-logstash-input/95733/4 "2017-08-31T17:50:30Z")

</div>

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