# Multiline Filebeat

**URL:** <https://discuss.elastic.co/t/multiline-filebeat/174817>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [April 1, 2019, 3:59pm UTC](https://discuss.elastic.co/t/multiline-filebeat/174817 "2019-04-01T15:59:12Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jasonespo](https://avatars.discourse-cdn.com/v4/letter/j/898d66/32.png) [@Jasonespo](https://discuss.elastic.co/u/Jasonespo)\
**Post date:** [April 1, 2019, 3:59pm UTC](https://discuss.elastic.co/t/multiline-filebeat/174817/1 "2019-04-01T15:59:13Z")

</div>

Hi all!

HELP PLEASE! 🙂

I have a log file, each "log" consists of 4 lines and is separated by \*\* Alert. [Simple enough]

Can somebody try to explain why this is not working??

Example Log:

```
** Alert 1554131277.244802: - pam,syslog,
2019 Apr 01 15:07:57 OSSEC_Hids->/var/log/auth.log
Rule: 5502 (level 3) -> 'Login session closed.'
Apr 1 15:07:56 OSSEC_Hids sudo: pam_unix(sudo:session): session closed for user root

```

As shown in the below screenshot:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/8/9/89f2b5f7e6c541f46dc74953d128eb7f8000cbf6.png)

And I am using

```
multiline:
pattern: '^\*'
negate: true
match: after

```

As shown in screenshot below:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/6/7/679a09245d7ee792381d3fa01850d18ab66ea0f0.png)

The regex must work:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/5/3/53a24decdd0ad48c9e1554fab64660ea80ccf3ef.png)

I am going crazy.

---

<div class="post-metadata">

**Author:** ![Michal\_Pristas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/michal_pristas/32/46639_2.png) [@Michal\_Pristas](https://discuss.elastic.co/u/Michal_Pristas)\
**Post date:** [April 2, 2019, 11:30am UTC](https://discuss.elastic.co/t/multiline-filebeat/174817/2 "2019-04-02T11:30:34Z")

</div>

> [@Jasonespo](#):
>
> multiline: pattern: '^\*' negate: true match: after

hey @Jasonespo

not sure if the formatting of your input is incorrect but first thing I would check is indentation of you config  
try replacing this:

```yaml
multiline:
pattern: '^\*'
negate: true
match: after

```

with this

```yams
multiline:
    pattern: '^\*'
    negate: true
    match: after

```

or flatten the config as in the example

```yams
multiline.pattern: '^\*'
multiline.negate: true
multiline.match: after

```

---

<div class="post-metadata">

**Author:** ![Jasonespo](https://avatars.discourse-cdn.com/v4/letter/j/898d66/32.png) [@Jasonespo](https://discuss.elastic.co/u/Jasonespo)\
**Post date:** [April 3, 2019, 9:22am UTC](https://discuss.elastic.co/t/multiline-filebeat/174817/3 "2019-04-03T09:22:50Z")

</div>

Hi and thank you for the response @Michal_Pristas.

I have tried both those formats and after restarting filebeat after each change, I was getting the same output.

If the logic is correct I have no idea what else could be wrong.

I want all 4 lines in each alert to be considered as one line, this is what I believe the multiline parameter does?

---

<div class="post-metadata">

**Author:** ![BKG](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bkg/32/43591_2.png) [@BKG](https://discuss.elastic.co/u/BKG)\
**Post date:** [April 3, 2019, 11:27am UTC](https://discuss.elastic.co/t/multiline-filebeat/174817/4 "2019-04-03T11:27:07Z")

</div>

Tried double quotes? Could be some quirk.

---

<div class="post-metadata">

**Author:** ![Michal\_Pristas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/michal_pristas/32/46639_2.png) [@Michal\_Pristas](https://discuss.elastic.co/u/Michal_Pristas)\
**Post date:** [April 3, 2019, 11:39am UTC](https://discuss.elastic.co/t/multiline-filebeat/174817/5 "2019-04-03T11:39:48Z")

</div>

one more thing comes to mind.  
is your multiline config under inputs config section? multiline must specify specific prospector

example:

```auto
filebeat.prospectors:
- type: log
  paths:
    - /my/path/to/*.log
  multiline:
    pattern: '^\*'
    negate: true
    match: after

```

---

<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 1, 2019, 11:39am UTC](https://discuss.elastic.co/t/multiline-filebeat/174817/6 "2019-05-01T11:39:49Z")

</div>

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