# Remove some fields about logstash

**URL:** <https://discuss.elastic.co/t/remove-some-fields-about-logstash/98454>\
**Category:** Logstash\
**Created:** [August 26, 2017, 1:10pm UTC](https://discuss.elastic.co/t/remove-some-fields-about-logstash/98454 "2017-08-26T13:10:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![f26227279](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/f26227279/32/21296_2.png) [@f26227279](https://discuss.elastic.co/u/f26227279)\
**Post date:** [August 26, 2017, 1:10pm UTC](https://discuss.elastic.co/t/remove-some-fields-about-logstash/98454/1 "2017-08-26T13:10:43Z")

</div>

Hi everyone,  
I add three fields: day,month,year to adjust my index time.  
But I want to remove these three fields.  
How can I do .

```
input {
stdin { }
}
filter {
	
    grok {
            match => { "message" => '%{SYSLOGTIMESTAMP} %{IPV4:iphost} date=%{YEAR:year}-%{MONTHNUM:month}-%{MONTHDAY:day} %{GREEDYDATA:fgtlogmsg}'
            }
			match => { "message" => '<%{NONNEGINT:syslog_pri}>date=%{YEAR:year}-%{MONTHNUM:month}-%{MONTHDAY:day} %{GREEDYDATA:fgtlogmsg}'
            }
			
    }
	
    kv {
            source => "fgtlogmsg"
			remove_field => ["fgtlogmsg"]
    }

	syslog_pri { }
	if "_grokparsefailure" in [tags] {
	drop { }
}
}
output {
    elasticsearch {
            codec => "json" 
            hosts => ["127.0.0.1:9200"]
			index => "logstash-%{year}-%{month}-%{day}"
            
    }
    stdout { codec => rubydebug }
}

```

thank you in advance : )

---

<div class="post-metadata">

**Author:** ![immavalls](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/immavalls/32/146501_2.png) [@immavalls](https://discuss.elastic.co/u/immavalls)\
**Post date:** [August 27, 2017, 6:40am UTC](https://discuss.elastic.co/t/remove-some-fields-about-logstash/98454/2 "2017-08-27T06:40:04Z")

</div>

Could you use metadata, instead of fields? See [https://www.elastic.co/blog/logstash-metadata](https://www.elastic.co/blog/logstash-metadata).

---

<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:** [September 24, 2017, 6:40am UTC](https://discuss.elastic.co/t/remove-some-fields-about-logstash/98454/3 "2017-09-24T06:40:16Z")

</div>

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