# Processing multiline events from filebeat

**URL:** <https://discuss.elastic.co/t/processing-multiline-events-from-filebeat/126771>\
**Category:** Logstash\
**Created:** [April 4, 2018, 3:11pm UTC](https://discuss.elastic.co/t/processing-multiline-events-from-filebeat/126771 "2018-04-04T15:11:49Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![las](https://avatars.discourse-cdn.com/v4/letter/l/5f9b8f/32.png) [@las](https://discuss.elastic.co/u/las)\
**Post date:** [April 4, 2018, 3:11pm UTC](https://discuss.elastic.co/t/processing-multiline-events-from-filebeat/126771/1 "2018-04-04T15:11:50Z")

</div>

Filebeat has been configured to read file and produce multiline events that are sent to logstash.

In logstash, I want to combine multiple multiline events using grok and aggregate filters.

As part of grok, I also want the original message to be sent to ES.

time some random text key value  
Key1 val1  
Key2 val2  
...

I want to aggregate based on key2.

---

<div class="post-metadata">

**Author:** ![Suman\_Reddy1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/suman_reddy1/32/27303_2.png) [@Suman\_Reddy1](https://discuss.elastic.co/u/Suman_Reddy1)\
**Post date:** [April 4, 2018, 3:27pm UTC](https://discuss.elastic.co/t/processing-multiline-events-from-filebeat/126771/2 "2018-04-04T15:27:27Z")

</div>

Can you post some sample log lines.  
I think you can use Logstash Multline Codec for your purpose.

Edit: And what I would suggest is put your multiline codec at Filebeat itself.

---

<div class="post-metadata">

**Author:** ![las](https://avatars.discourse-cdn.com/v4/letter/l/5f9b8f/32.png) [@las](https://discuss.elastic.co/u/las)\
**Post date:** [April 4, 2018, 3:29pm UTC](https://discuss.elastic.co/t/processing-multiline-events-from-filebeat/126771/3 "2018-04-04T15:29:58Z")

</div>

I have put the multiline processing in filebeat and it's working. At logstash, I want to aggregate multiple multiline events if the events contain same value for key2. I have pasted a sample message above.

---

<div class="post-metadata">

**Author:** ![Suman\_Reddy1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/suman_reddy1/32/27303_2.png) [@Suman\_Reddy1](https://discuss.elastic.co/u/Suman_Reddy1)\
**Post date:** [April 4, 2018, 3:33pm UTC](https://discuss.elastic.co/t/processing-multiline-events-from-filebeat/126771/4 "2018-04-04T15:33:26Z")

</div>

If I understand correctly you are trying to group multiple log lines at Logstash also, based on some value which matches in the previous log event. Is that correct?

Edit: If that is the case am not sure how to do it. I am afraid it is not even possible I think.!!

---

<div class="post-metadata">

**Author:** ![las](https://avatars.discourse-cdn.com/v4/letter/l/5f9b8f/32.png) [@las](https://discuss.elastic.co/u/las)\
**Post date:** [April 4, 2018, 3:38pm UTC](https://discuss.elastic.co/t/processing-multiline-events-from-filebeat/126771/5 "2018-04-04T15:38:20Z")

</div>

12:12:12 processed T1  
data1 val1  
data2 val2  
dataId 1111  
data7 val7

Above log lines get combined by beat and sent to logstash as 1 event. I will receive multiple like this that need to be aggregated based on dataId key.

---

<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:** [May 2, 2018, 3:38pm UTC](https://discuss.elastic.co/t/processing-multiline-events-from-filebeat/126771/6 "2018-05-02T15:38:24Z")

</div>

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