# Detect last n lines in a log file

**URL:** <https://discuss.elastic.co/t/detect-last-n-lines-in-a-log-file/119834>\
**Category:** Logstash\
**Created:** [February 14, 2018, 3:41pm UTC](https://discuss.elastic.co/t/detect-last-n-lines-in-a-log-file/119834 "2018-02-14T15:41:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cilzzz](https://avatars.discourse-cdn.com/v4/letter/c/c67d28/32.png) [@cilzzz](https://discuss.elastic.co/u/cilzzz)\
**Post date:** [February 14, 2018, 3:41pm UTC](https://discuss.elastic.co/t/detect-last-n-lines-in-a-log-file/119834/1 "2018-02-14T15:41:04Z")

</div>

how to read only the last n lines in a logfile using logstash to be able to parse it and drop all the others knowing that there are some duplicate lines?

---

<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:** [March 14, 2018, 3:41pm UTC](https://discuss.elastic.co/t/detect-last-n-lines-in-a-log-file/119834/2 "2018-03-14T15:41:11Z")

</div>

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