# Multiple log in input, how to filter one by one?

**URL:** <https://discuss.elastic.co/t/multiple-log-in-input-how-to-filter-one-by-one/176882>\
**Category:** Logstash\
**Created:** [April 15, 2019, 10:32am UTC](https://discuss.elastic.co/t/multiple-log-in-input-how-to-filter-one-by-one/176882 "2019-04-15T10:32:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![fabueno](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fabueno/32/44144_2.png) [@fabueno](https://discuss.elastic.co/u/fabueno)\
**Post date:** [April 15, 2019, 10:32am UTC](https://discuss.elastic.co/t/multiple-log-in-input-how-to-filter-one-by-one/176882/1 "2019-04-15T10:32:18Z")

</div>

Hi, Im a beginner with ELK and I want to apply different filter on my log.  
This is my input file :  
input {  
beats {  
type =\> log  
port =\> 5044  
host =\> 0.0.0.0  
}  
}  
With this file, we listen on port 5044, from everywhre, and each log we received on this port will have the log type. Are we ok ?

Now if i receive Apache log on this port, and Syslog too for example, how can I filter filter them. I mean how in the filter I can take only apache log, or only log file ?

And when I used filebeat modules, should I have to create by my self a filter file ?

Sorry for bad english and thank you.

---

<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:** [April 15, 2019, 11:45am UTC](https://discuss.elastic.co/t/multiple-log-in-input-how-to-filter-one-by-one/176882/2 "2019-04-15T11:45:45Z")

</div>

[This](https://discuss.elastic.co/t/if-condition-in-logstash-filter-not-working/164577) thread has an example of making adding fields to a record in filebeat and using conditionals in the filter in logstash.

---

<div class="post-metadata">

**Author:** ![fabueno](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fabueno/32/44144_2.png) [@fabueno](https://discuss.elastic.co/u/fabueno)\
**Post date:** [April 16, 2019, 6:50am UTC](https://discuss.elastic.co/t/multiple-log-in-input-how-to-filter-one-by-one/176882/3 "2019-04-16T06:50:13Z")

</div>

Hi and thanks.

When I have this input :

```auto
filebeat.inputs:
- type: log
  paths:
    - /var/log/auth1.log
  fields:
    log_type: auth1
  fields_under_root: true
- type: log
  paths:
    - /var/log/auth2.log
  fields:
    log_type: auth2
  fields_under_root: true

```

My filter file will start like :  
filter {  
if [log\_type] == "auth1" {  
grok { blabla }  
}  
}

This will be ok ?

---

<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:** [April 16, 2019, 12:01pm UTC](https://discuss.elastic.co/t/multiple-log-in-input-how-to-filter-one-by-one/176882/4 "2019-04-16T12:01:35Z")

</div>

> [@fabueno](#):
>
> This will be ok ?

That looks right, yes.

---

<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 14, 2019, 12:01pm UTC](https://discuss.elastic.co/t/multiple-log-in-input-how-to-filter-one-by-one/176882/5 "2019-05-14T12:01:41Z")

</div>

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