# How to retrieve JSON object from log in logstash confuguration?

**URL:** <https://discuss.elastic.co/t/how-to-retrieve-json-object-from-log-in-logstash-confuguration/153375>\
**Category:** Logstash\
**Created:** [October 22, 2018, 10:23am UTC](https://discuss.elastic.co/t/how-to-retrieve-json-object-from-log-in-logstash-confuguration/153375 "2018-10-22T10:23:02Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![Vyankatesh\_S\_Repal](https://avatars.discourse-cdn.com/v4/letter/v/c77e96/32.png) [@Vyankatesh\_S\_Repal](https://discuss.elastic.co/u/Vyankatesh_S_Repal)\
**Post date:** [October 23, 2018, 11:50am UTC](https://discuss.elastic.co/t/how-to-retrieve-json-object-from-log-in-logstash-confuguration/153375/5 "2018-10-23T11:50:59Z")

</div>

Thanks redX, it worked. Can you please take a look at this question too?

> [@How to retrieve n number of previous lines in log file using logstash configuration?](https://discuss.elastic.co/t/how-to-retrieve-n-number-of-previous-and-after-lines-in-log-file-using-logstash-configuration/153350):
>
> I am creating an application where I need to put previous and after n number of lines in elasticsearch with current log. This is my current logstash configuraion. What changes I need to make so that I can retrieve last n number of lines(Let's say 5) in my output? input{ file{ path =\> "D:\ELK\_Info\TestLogs\_Updated.log" #start\_position =\> beginning ignore\_older =\> 0 sincedb\_path =\> "NUL" codec =\> multiline { pattern =\> "^%{TIMESTAMP\_ISO8601}" …

---

_[View the full topic](https://discuss.elastic.co/t/how-to-retrieve-json-object-from-log-in-logstash-confuguration/153375)._
