# Keep only certain line

**URL:** <https://discuss.elastic.co/t/keep-only-certain-line/136996>\
**Category:** Logstash\
**Created:** [June 22, 2018, 9:09am UTC](https://discuss.elastic.co/t/keep-only-certain-line/136996 "2018-06-22T09:09:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dyl](https://avatars.discourse-cdn.com/v4/letter/d/5fc32e/32.png) [@dyl](https://discuss.elastic.co/u/dyl)\
**Post date:** [June 22, 2018, 9:09am UTC](https://discuss.elastic.co/t/keep-only-certain-line/136996/1 "2018-06-22T09:09:41Z")

</div>

Hello,

I use filebeat to send files to logstash and then logstash parse them.

During the parse, is it possible to do :

```
if [number_line != "3"]
{
  drop { }
}

```

To keep only the line 3 of the file ?

Thx you

---

<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:** [June 25, 2018, 9:57pm UTC](https://discuss.elastic.co/t/keep-only-certain-line/136996/2 "2018-06-25T21:57:18Z")

</div>

No. Filebeat doesn't track the line number, only the file offset.

---

<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 23, 2018, 9:57pm UTC](https://discuss.elastic.co/t/keep-only-certain-line/136996/3 "2018-07-23T21:57:19Z")

</div>

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