# How to filter out certain lines from log file in logstash

**URL:** <https://discuss.elastic.co/t/how-to-filter-out-certain-lines-from-log-file-in-logstash/41010>\
**Category:** Logstash\
**Created:** [February 4, 2016, 10:05pm UTC](https://discuss.elastic.co/t/how-to-filter-out-certain-lines-from-log-file-in-logstash/41010 "2016-02-04T22:05:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![subbu.nv](https://avatars.discourse-cdn.com/v4/letter/s/439d5e/32.png) [@subbu.nv](https://discuss.elastic.co/u/subbu.nv)\
**Post date:** [February 4, 2016, 10:05pm UTC](https://discuss.elastic.co/t/how-to-filter-out-certain-lines-from-log-file-in-logstash/41010/1 "2016-02-04T22:05:52Z")

</div>

Hi,

i am current have a log file with following lines

\*\*\*\*\* TESTINGG Finished  
Start Time: 02:05:33 Oct 11 2015 Temp: 46 C: 46 C: 43 C: 40 C: 40 C: 53 C: 59 C  
End Time: 01:35:45 Oct 13 2015 Temp: 52 C: 49 C: 49 C: 41 C: 41 C: 55 C: 62 C  
Total Test Time: 01 days:23 hrs:30 min:12 sec  
Total Cycles: 1 cycles  
RUNIN Test FAILED  
FILE\_PATH:/opt/web/test/abc/

i need to take out the FILE\_PATH and add it into a separate field. can some one help me in doing this?

currently using below tag that puts the complete line in a message.

grok {  
match =\> { "message" =\> "%{COMBINEDAPACHELOG}"}  
}

---

<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:** [February 4, 2016, 10:07pm UTC](https://discuss.elastic.co/t/how-to-filter-out-certain-lines-from-log-file-in-logstash/41010/2 "2016-02-04T22:07:45Z")

</div>

Um, COMBINEDAPACHELOG is for Apache logs and this isn't an Apache log. But you should use the grok filter:

```auto
grok {
  match => { "message" => "^FILE_PATH:%{GREEDYDATA:filepath}" }
}

```

---

<div class="post-metadata">

**Author:** ![subbu.nv](https://avatars.discourse-cdn.com/v4/letter/s/439d5e/32.png) [@subbu.nv](https://discuss.elastic.co/u/subbu.nv)\
**Post date:** [February 4, 2016, 10:41pm UTC](https://discuss.elastic.co/t/how-to-filter-out-certain-lines-from-log-file-in-logstash/41010/3 "2016-02-04T22:41:49Z")

</div>

thanks a lot. it works

---

<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, 5:12am UTC](https://discuss.elastic.co/t/how-to-filter-out-certain-lines-from-log-file-in-logstash/41010/4 "2017-07-06T05:12:59Z")

</div>


