# Logstash output file has additional fields

**URL:** <https://discuss.elastic.co/t/logstash-output-file-has-additional-fields/49892>\
**Category:** Logstash\
**Created:** [May 12, 2016, 11:36am UTC](https://discuss.elastic.co/t/logstash-output-file-has-additional-fields/49892 "2016-05-12T11:36:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![vijay\_dhaks](https://avatars.discourse-cdn.com/v4/letter/v/258eb7/32.png) [@vijay\_dhaks](https://discuss.elastic.co/u/vijay_dhaks)\
**Post date:** [May 12, 2016, 11:36am UTC](https://discuss.elastic.co/t/logstash-output-file-has-additional-fields/49892/1 "2016-05-12T11:36:00Z")

</div>

Hi,

My config is as below  
`filter { grok { match => { "message" => "%{DATE_EU:mydate}%{SPACE}%{HOUR:myhour}.%{MINUTE:myminute}.%{SECOND:mysecond}%{SPACE}%{GREEDYDATA:realdata}"} }`

and my input is as below  
`16.04.2015 00.02.31:125 RECV MO ID:routernode6@nbpagpapp6:520920746 CID:C50836 DA:95999-E164A OA:6281230252381-E164N EX:T NI:smpp-mo N/A UD:OFF\ MD`

and my output is as below  
`{"message":"16.04.2015 00.02.31:125 RECV MO ID:routernode6@nbpagpapp6:520920746 CID:C50836 DA:95999-E164A OA:6281230252381-E164N EX:T NI:smpp-mo N/A UD:OFF\\ MD","@version":"1","@timestamp":"2016-05-12T11:10:49.936Z","path":"/home/test/project/logstash_sample_data/api_trace_input.log","host":"vijayvm.mav.com","mydate":"16.04.2015","myhour":"00","myminute":"02","mysecond":"31:125","realdata":"RECV MO ID:routernode6@nbpagpapp6:520920746 CID:C50836 DA:95999-E164A OA:6281230252381-E164N EX:T NI:smpp-mo N/A UD:OFF\\ MD"}`

My question is based on my grok filter, I have to get only below as output.  
`{"mydate":"16.04.2015","myhour":"00","myminute":"02","mysecond":"31:125","realdata":"RECV MO ID:routernode6@nbpagpapp6:520920746 CID:C50836 DA:95999-E164A OA:6281230252381-E164N EX:T NI:smpp-mo N/A UD:OFF\\ MD"}}`

But May I know why is it printing additional items like "message", "path" and "host" ?

---

<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:** [May 12, 2016, 12:46pm UTC](https://discuss.elastic.co/t/logstash-output-file-has-additional-fields/49892/2 "2016-05-12T12:46:51Z")

</div>

The file input adds the `host` and `path` fields and the `message` field is a leftover from the original input that you grokked. If you don't want to have the fields you can remove them with the `remove_field` option of e.g. a mutate filter.

---

<div class="post-metadata">

**Author:** ![vijay\_dhaks](https://avatars.discourse-cdn.com/v4/letter/v/258eb7/32.png) [@vijay\_dhaks](https://discuss.elastic.co/u/vijay_dhaks)\
**Post date:** [May 12, 2016, 1:48pm UTC](https://discuss.elastic.co/t/logstash-output-file-has-additional-fields/49892/3 "2016-05-12T13:48:23Z")

</div>

thanks @magnusbaeck, I could remove it with mutate filter. I understood 'host' and 'path' are added by file input. But that 'message' doesnt seems to be the leftover of grok.

---

<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:** [May 12, 2016, 6:13pm UTC](https://discuss.elastic.co/t/logstash-output-file-has-additional-fields/49892/4 "2016-05-12T18:13:10Z")

</div>

> But that 'message' doesnt seems to be the leftover of grok.

Your grok filter parses the `message` field so you obviously have a `message` field. If you don't need that field after you've parsed it you have to remove it yourself.

---

<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:** [July 6, 2017, 4:57am UTC](https://discuss.elastic.co/t/logstash-output-file-has-additional-fields/49892/5 "2017-07-06T04:57:50Z")

</div>

Closed on July 6, 2017, 4:57am UTC


