# Multiline logs with a unique identifier

**URL:** <https://discuss.elastic.co/t/multiline-logs-with-a-unique-identifier/145845>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [August 24, 2018, 6:18am UTC](https://discuss.elastic.co/t/multiline-logs-with-a-unique-identifier/145845 "2018-08-24T06:18:12Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![NerdSec](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nerdsec/32/22056_2.png) [@NerdSec](https://discuss.elastic.co/u/NerdSec)\
**Post date:** [August 24, 2018, 6:18am UTC](https://discuss.elastic.co/t/multiline-logs-with-a-unique-identifier/145845/1 "2018-08-24T06:18:12Z")

</div>

Hi All,

I am reading messages from a syslog file in the following format:

```auto
<161>notify-1089122.1.alert: abcd
<161>notify-1089122.2.alert: xyz
<161>notify-1089133.1.alert: abc
<161>notify-1089122.3.alert: qwer

```

These are actually, multi line messages that are broken down by the syslog that is sending these into parts. They all have a unique identifier that tells, that they are part of the same event. How do I convert them to a single line?

The usual patterns do not work in this scenario. I need FileBeat to compare the lines using the unique identifier.

Regards,  
Nachiket

---

<div class="post-metadata">

**Author:** ![pierhugues](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pierhugues/32/48383_2.png) [@pierhugues](https://discuss.elastic.co/u/pierhugues)\
**Post date:** [August 24, 2018, 2:55pm UTC](https://discuss.elastic.co/t/multiline-logs-with-a-unique-identifier/145845/2 "2018-08-24T14:55:54Z")

</div>

@NerdSec I think you want the following output?

```auto
<161>notify-1089122.1.alert: abcd xyz qwer
<161>notify-1089133.1.alert: abc

```

---

<div class="post-metadata">

**Author:** ![NerdSec](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nerdsec/32/22056_2.png) [@NerdSec](https://discuss.elastic.co/u/NerdSec)\
**Post date:** [August 25, 2018, 4:02am UTC](https://discuss.elastic.co/t/multiline-logs-with-a-unique-identifier/145845/3 "2018-08-25T04:02:35Z")

</div>

Thank you for the reply pier. Yes, that is exactly the intended output.

---

<div class="post-metadata">

**Author:** ![pierhugues](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pierhugues/32/48383_2.png) [@pierhugues](https://discuss.elastic.co/u/pierhugues)\
**Post date:** [August 27, 2018, 3:20pm UTC](https://discuss.elastic.co/t/multiline-logs-with-a-unique-identifier/145845/4 "2018-08-27T15:20:22Z")

</div>

@NerdSec currently multiline doesn't support aggregating out of order events which is what you need, you might be able to do it with Logstash and the [Logstash aggregate filter]([https://www.elastic.co/guide/en/logstash/current/plugins-filters-aggregate.html](https://www.elastic.co/guide/en/logstash/current/plugins-filters-aggregate.html)

---

<div class="post-metadata">

**Author:** ![NerdSec](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nerdsec/32/22056_2.png) [@NerdSec](https://discuss.elastic.co/u/NerdSec)\
**Post date:** [August 28, 2018, 5:21pm UTC](https://discuss.elastic.co/t/multiline-logs-with-a-unique-identifier/145845/5 "2018-08-28T17:21:31Z")

</div>

Thanks for the confirmation pier. I ended up receiving logs over http and parsing the corresponding json, using the http input in logstash.

---

<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:** [September 25, 2018, 5:36pm UTC](https://discuss.elastic.co/t/multiline-logs-with-a-unique-identifier/145845/6 "2018-09-25T17:36:05Z")

</div>

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