# Grok filters works separately when combined it does not work. Please help

**URL:** <https://discuss.elastic.co/t/grok-filters-works-separately-when-combined-it-does-not-work-please-help/225579>\
**Category:** Logstash\
**Created:** [March 29, 2020, 8:00pm UTC](https://discuss.elastic.co/t/grok-filters-works-separately-when-combined-it-does-not-work-please-help/225579 "2020-03-29T20:00:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ranjini](https://avatars.discourse-cdn.com/v4/letter/r/898d66/32.png) [@ranjini](https://discuss.elastic.co/u/ranjini)\
**Post date:** [March 29, 2020, 8:00pm UTC](https://discuss.elastic.co/t/grok-filters-works-separately-when-combined-it-does-not-work-please-help/225579/1 "2020-03-29T20:00:01Z")

</div>

Please find my conf file. The filters works fine when used separate file but when combined they dont show the parsed fields in kibana.

```auto
input {
  file {
    path => "/var/log/messages"
    start_position => "beginning"
	type => "messages"
    start_position => beginning
    sincedb_path => "/dev/null"
    ignore_older => 0
  }
  file {
    path => "/var/log/chef-client.log"
    type => "chef-client"
    start_position => beginning
    sincedb_path => "/dev/null"
    ignore_older => 0
  }  
}
filter {
if [type] == "messages"{
 grok {
                           match => {"message" => "%{SYSLOGTIMESTAMP:logtimeStamp} %{USERNAME:systemname} %{GREEDYDATA:message}"}
                           overwrite => ["message"]
                           remove_field => ["@timestamp", "@version", "systemname"]
                         }
						 
mutate {
        split => ["host", "."]
        add_field => { "hostname" => "%{[host][0]}" }
        add_field => { "podName" => "%{[host][1]}" }
        add_field => { "ignore" => "%{[host][2]}" }
        remove_field => ["ignore", "host"]
    }
	mutate {
        split => ["path", "/"]
        add_field => { "logfileName" => "%{[path][3]}" }
        add_field => { "logPath" => "%{[path][2]}" }
        remove_field => ["path", "logPath"]
    }
	
	if [type] == "chef-client" {
                grok {
                           match => {"message" => "\[%{TIMESTAMP_ISO8601:logtimestamp}\] %{SPACE}%{LOGLEVEL:loglevel}:%{SPACE}%{GREEDYDATA:message}"}
                           overwrite => ["message"]
                           remove_field => ["@timestamp", "@version"]
                         }
mutate {
        split => ["host", "."]
        add_field => { "hostname" => "%{[host][0]}" }
        add_field => { "podName" => "%{[host][1]}" }
        add_field => { "ignore" => "%{[host][2]}" }
        remove_field => ["ignore", "host"]
    }
mutate {
        split => ["path", "/"]
        add_field => { "logfileName" => "%{[path][3]}" }
        add_field => { "logPath" => "%{[path][2]}" }
        remove_field => ["path", "logPath"]
    }
	
 }
if "_grokparsefailure" in [tags] {
            drop { }
        }
}
}

output { 
  amazon_es {
    hosts => ["${ES_ENDPOINT}"]
    region => "us-west-2"
    index => "test-%{+YYYY.MM.dd}"    	
}
}

```

---

<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:** [March 29, 2020, 11:11pm UTC](https://discuss.elastic.co/t/grok-filters-works-separately-when-combined-it-does-not-work-please-help/225579/2 "2020-03-29T23:11:24Z")

</div>

> [@ranjini](#):
>
> ignore\_older =\> 0

In filebeat setting ignore\_older to zero disables age based filtering.

In logstash setting ignore\_older to zero ignores all files more than zero seconds old, resulting in the file input not consuming any files.

---

<div class="post-metadata">

**Author:** ![ranjini](https://avatars.discourse-cdn.com/v4/letter/r/898d66/32.png) [@ranjini](https://discuss.elastic.co/u/ranjini)\
**Post date:** [March 31, 2020, 6:37pm UTC](https://discuss.elastic.co/t/grok-filters-works-separately-when-combined-it-does-not-work-please-help/225579/3 "2020-03-31T18:37:42Z")

</div>

I removed the entry ignore\_older =\> 0. I have different file conf file with pipeline can the index be same for all. pipeline.yml -- /etc/logstash/conf/\*.conf. please let me if this is right way and does this work.

---

<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:** [April 28, 2020, 6:37pm UTC](https://discuss.elastic.co/t/grok-filters-works-separately-when-combined-it-does-not-work-please-help/225579/4 "2020-04-28T18:37:46Z")

</div>

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