# How to filter Filebeat input in Logstash from different log?

**URL:** <https://discuss.elastic.co/t/how-to-filter-filebeat-input-in-logstash-from-different-log/148480>\
**Category:** Logstash\
**Created:** [September 13, 2018, 4:23pm UTC](https://discuss.elastic.co/t/how-to-filter-filebeat-input-in-logstash-from-different-log/148480 "2018-09-13T16:23:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rahmat\_Agung\_W](https://avatars.discourse-cdn.com/v4/letter/r/c0e974/32.png) [@Rahmat\_Agung\_W](https://discuss.elastic.co/u/Rahmat_Agung_W)\
**Post date:** [September 13, 2018, 4:23pm UTC](https://discuss.elastic.co/t/how-to-filter-filebeat-input-in-logstash-from-different-log/148480/1 "2018-09-13T16:23:10Z")

</div>

So, I have a VPS and have 2 json log from 2 different services. I used Filebeat to forward my log to ELK Stack Server. This is my filebeat.yml:

```
filebeat.inputs:
- type: log
  paths:
    - /home/cowrie/cowrie/log/cowrie.json*
  encoding: plain
  fields:
    document_type: cowrie

- type: log
  paths:
    - /opt/dionaea/var/lib/dionaea/dionaea.json*
  encoding: plain
  fields:
    document_type: dionaea

output.logstash:
  hosts: ["10.33.109.64:5044"]

logging.to_files: true
logging.files:
  path: /var/log/filebeat/
  name: mybeat-vpn
  rotateeverybytes: 10485760 # = 10MB
  keepfiles: 7

```

I want to filter each log( cowrie and dionaea) with different rule on Logstash. This my logstash config:

```
input {
   beats {
       port => 5044
   }
}
filter{
 if [type] == "cowrie" {
.......some filter..........
}
 if [type] == "dionaea" {
.......some filter..........
}
}

output {
   elasticsearch {   
    hosts => ["10.33.109.24:9200"]
	}
}

```

I just wondering, what is the condition for this --\>if [type] == "cowrie" because i can not declare type field in input. There is only beat input in this configuration. TL;DR I want to separate this 2 logs with different filter rule.

---

<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:** [September 14, 2018, 6:14am UTC](https://discuss.elastic.co/t/how-to-filter-filebeat-input-in-logstash-from-different-log/148480/2 "2018-09-14T06:14:06Z")

</div>

> I just wondering, what is the condition for this --\>if [type] == "cowrie" because i can not declare type field in input.

Yes you can. You can define any fields you like in the Filebeat configuration.

---

<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 12, 2018, 6:14am UTC](https://discuss.elastic.co/t/how-to-filter-filebeat-input-in-logstash-from-different-log/148480/3 "2018-10-12T06:14:10Z")

</div>

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