# Logstash- getting specific lines

**URL:** https://discuss.elastic.co/t/logstash-getting-specific-lines/181086
**Category:** Logstash
**Created:** [May 15, 2019, 12:17am UTC](https://discuss.elastic.co/t/logstash-getting-specific-lines/181086 "2019-05-15T00:17:50Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Godson\_Raju](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/godson_raju/32/46189_2.png) [@Godson\_Raju](https://discuss.elastic.co/u/Godson_Raju)
#### Post date: [May 15, 2019, 12:17am UTC](https://discuss.elastic.co/t/logstash-getting-specific-lines/181086/1 "2019-05-15T00:17:50Z")

</div>

I was wondering if I can get the 10 lines following the Keyword "Exception" in the message field of a Tomcat log file. I am able to get the lines with a specific keyword but failed to get the lines following the line with the keyword.

Thanks.

---

<div class="post-metadata">

### Author: ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)
#### Post date: [May 15, 2019, 2:32pm UTC](https://discuss.elastic.co/t/logstash-getting-specific-lines/181086/2 "2019-05-15T14:32:22Z")

</div>

You can maintain state in an aggregate filter. [This post](https://discuss.elastic.co/t/aggregate-filter-push-on-event-size-limit/180875/2) has an example of collecting data in the map and then generating an event when some condition is met.

It is not a scaleable solution and is really not a use case logstash was designed for.

---

<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: [June 12, 2019, 2:32pm UTC](https://discuss.elastic.co/t/logstash-getting-specific-lines/181086/3 "2019-06-12T14:32:28Z")

</div>

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