# Multiple Line in Single Event

**URL:** <https://discuss.elastic.co/t/multiple-line-in-single-event/88739>\
**Category:** Logstash\
**Created:** [June 8, 2017, 4:17pm UTC](https://discuss.elastic.co/t/multiple-line-in-single-event/88739 "2017-06-08T16:17:33Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![sanupam](https://avatars.discourse-cdn.com/v4/letter/s/a4c791/32.png) [@sanupam](https://discuss.elastic.co/u/sanupam)\
**Post date:** [June 8, 2017, 4:17pm UTC](https://discuss.elastic.co/t/multiple-line-in-single-event/88739/1 "2017-06-08T16:17:33Z")

</div>

Hi,

Consider the below example:

Logfile:

START  
INFO: NOTIFICATION\_ID,NOTIFICATION\_TYPE,NOTIFICATION\_DATE,ORDER\_REFERENCE,US\_ID,SIO\_ID,ORIGINAL\_ORDER\_REFERENCE,ACCESS\_QUOTE\_REF,PHONE,ADDRESS1,ADDRESS2,ADDRESS3,POSTAL\_CODE,CITY,STATE,COUNTRY  
Jun 05, 2017 6:45:07 AM sai.pollers.SaiPollerServlet info  
END

The above logfile contains the two delimeter START and END.  
Now I want to print the log between these two delimeter in Single Event every time.

Can you please share the configuration required for this in logstash.

Regards,  
Anupam

---

<div class="post-metadata">

**Author:** ![sanupam](https://avatars.discourse-cdn.com/v4/letter/s/a4c791/32.png) [@sanupam](https://discuss.elastic.co/u/sanupam)\
**Post date:** [June 11, 2017, 4:40pm UTC](https://discuss.elastic.co/t/multiple-line-in-single-event/88739/2 "2017-06-11T16:40:02Z")

</div>

Can anyone help me for my query.

Regards,  
Anupam

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [June 11, 2017, 6:19pm UTC](https://discuss.elastic.co/t/multiple-line-in-single-event/88739/3 "2017-06-11T18:19:52Z")

</div>

Do all log entries in this log file start with START and end with END, or are there other types of entries? If so, what do these look like?

---

<div class="post-metadata">

**Author:** ![sanupam](https://avatars.discourse-cdn.com/v4/letter/s/a4c791/32.png) [@sanupam](https://discuss.elastic.co/u/sanupam)\
**Post date:** [June 13, 2017, 8:18am UTC](https://discuss.elastic.co/t/multiple-line-in-single-event/88739/4 "2017-06-13T08:18:01Z")

</div>

These delimeter (START and END) will be unique.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [June 13, 2017, 8:39am UTC](https://discuss.elastic.co/t/multiple-line-in-single-event/88739/5 "2017-06-13T08:39:42Z")

</div>

If all events have the same structure, you should be able use the a [multiline codec](https://www.elastic.co/guide/en/logstash/current/plugins-codecs-multiline.html#plugins-codecs-multiline) with your input to groups all lines following START (up until the next START) into a single event:

```auto
codec => multiline {
  pattern => "^START"
  negate => true
  what => previous
  auto_flush_interval => 1
}

```

---

<div class="post-metadata">

**Author:** ![sanupam](https://avatars.discourse-cdn.com/v4/letter/s/a4c791/32.png) [@sanupam](https://discuss.elastic.co/u/sanupam)\
**Post date:** [June 14, 2017, 7:16am UTC](https://discuss.elastic.co/t/multiple-line-in-single-event/88739/6 "2017-06-14T07:16:20Z")

</div>

> [@sanupam](#):
>
> START  
> INFO: NOTIFICATION\_ID,NOTIFICATION\_TYPE,NOTIFICATION\_DATE,ORDER\_REFERENCE,US\_ID,SIO\_ID,ORIGINAL\_ORDER\_REFERENCE,ACCESS\_QUOTE\_REF,PHONE,ADDRESS1,ADDRESS2,ADDRESS3,POSTAL\_CODE,CITY,STATE,COUNTRY  
> Jun 05, 2017 6:45:07 AM sai.pollers.SaiPollerServlet info  
> END

Hi,

Thanks.

This will fail in two cases.

1. If the logs is in below format then it won't work.

START // Start of Log  
INFO: NOTIFICATION\_ID,NOTIFICATION\_TYPE,NOTIFICATION\_DATE,ORDER\_REFERENCE,US\_ID,SIO\_ID,ORIGINAL\_ORDER\_REFERENCE,ACCESS\_QUOTE\_REF,PHONE,ADDRESS1,ADDRESS2,ADDRESS3,POSTAL\_CODE,CITY,STATE,COUNTRY  
Jun 05, 2017 6:45:07 AM sai.pollers.SaiPollerServlet info  
END // End of Log  
83.149.9.216 - - [04/Jan/2015:05:13:44 +0000] "GET /presentations/logstash-monitorama-2013/plugin/highlight/highlight.js HTTP/1.1" 200 26185 "[http://semicomplete.com/presentations/logstash-monitorama-2013/](http://semicomplete.com/presentations/logstash-monitorama-2013/)" "Mozilla/5.0  
83.149.9.216 - - [04/Jan/2015:05:13:44 +0000] "GET /presentations/logstash-monitorama-2013/plugin/highlight/highlight.js HTTP/1.1" 200 26185 "[http://semicomplete.com/presentations/logstash-monitorama-2013/](http://semicomplete.com/presentations/logstash-monitorama-2013/)" "Mozilla/5.0  
START // Start of Log  
83.149.9.216 - - [04/Jan/2015:05:13:42 +0000] "GET /presentations/logstash-monitorama-2013/  
END // End of Log

I doesn't need the line between END to START i.e; between end delimeter and start delimeter.

2)The name of delimeter is in my control. I can also do the same for both start as START and end as START. But this will also fail.

START // Start of Log  
INFO: NOTIFICATION\_ID,NOTIFICATION\_TYPE,NOTIFICATION\_DATE,ORDER\_REFERENCE,US\_ID,SIO\_ID,ORIGINAL\_ORDER\_REFERENCE,ACCESS\_QUOTE\_REF,PHONE,ADDRESS1,ADDRESS2,ADDRESS3,POSTAL\_CODE,CITY,STATE,COUNTRY  
Jun 05, 2017 6:45:07 AM sai.pollers.SaiPollerServlet info  
START // End of Log  
83.149.9.216 - - [04/Jan/2015:05:13:44 +0000] "GET /presentations/logstash-monitorama-2013/plugin/highlight/highlight.js HTTP/1.1" 200 26185 "[http://semicomplete.com/presentations/logstash-monitorama-2013/](http://semicomplete.com/presentations/logstash-monitorama-2013/)" "Mozilla/5.0  
83.149.9.216 - - [04/Jan/2015:05:13:44 +0000] "GET /presentations/logstash-monitorama-2013/plugin/highlight/highlight.js HTTP/1.1" 200 26185 "[http://semicomplete.com/presentations/logstash-monitorama-2013/](http://semicomplete.com/presentations/logstash-monitorama-2013/)" "Mozilla/5.0  
START // Start of Log  
83.149.9.216 - - [04/Jan/2015:05:13:42 +0000] "GET /presentations/logstash-monitorama-2013/  
START // End of Log

Can you please suggest so that I can get the logs between start and end delimeters.

Thanks,  
Anupam

---

<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 12, 2017, 7:16am UTC](https://discuss.elastic.co/t/multiple-line-in-single-event/88739/7 "2017-07-12T07:16:27Z")

</div>

Closed on July 12, 2017, 7:16am UTC

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