# Filebeat merge several lines from mysql-slow.log into one line

**URL:** <https://discuss.elastic.co/t/filebeat-merge-several-lines-from-mysql-slow-log-into-one-line/207166>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [November 8, 2019, 8:18pm UTC](https://discuss.elastic.co/t/filebeat-merge-several-lines-from-mysql-slow-log-into-one-line/207166 "2019-11-08T20:18:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vladpov](https://avatars.discourse-cdn.com/v4/letter/v/8c91f0/32.png) [@Vladpov](https://discuss.elastic.co/u/Vladpov)\
**Post date:** [November 8, 2019, 8:18pm UTC](https://discuss.elastic.co/t/filebeat-merge-several-lines-from-mysql-slow-log-into-one-line/207166/1 "2019-11-08T20:18:30Z")

</div>

Hello everyone,

I'm trying to analyze mysql-slow.log by using Filebeat Logstash and Elasticsearch. I have messages in mysql-slow.log file that look like this:

```auto
# Time: 2019-11-08T20:02:05.474508Z
# User@Host: user[user] @ localhost [] Id: 2
# Query_time: 0.000716 Lock_time: 0.000223 Rows_sent: 2 Rows_examined: 2
SET timestamp=1573243325;
select * from Persons;

```

First I try to make Filebeat send this log message with 5 lines to elasticsearch but all of them together in one line.

I set multiline input in filebeat.yml

```auto
multiline.pattern = `^\#`
multiline.negate = true
multiline.match = after

```

Unfortunately it doesn't work and elasticsearch recieves lines separately

1. message --\> # Time: 2019-11-08T20:02:05.474508Z
2. message --\> # User@Host: user[user] @ localhost [?] Id: 2 and so on...

I want to recieve it in one message in the following format:

```auto
# Time: 2019-11-08T20:02:05.474508Z # User@Host: user[user] @ localhost [] Id: 2 # Query_time: 0.000716 Lock_time: 0.000223 Rows_sent: 2 Rows_examined: 2 SET timestamp=1573243325; select * from Persons;

```

Thanks for any help!

---

<div class="post-metadata">

**Author:** ![exekias](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/exekias/32/28718_2.png) [@exekias](https://discuss.elastic.co/u/exekias)\
**Post date:** [November 13, 2019, 11:32am UTC](https://discuss.elastic.co/t/filebeat-merge-several-lines-from-mysql-slow-log-into-one-line/207166/2 "2019-11-13T11:32:36Z")

</div>

Hi @Vladpov,

I'm wondering, did you try the MySQL module for this? It should take care of configuring the input for you, including slowlog: [https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-module-mysql.html](https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-module-mysql.html)

Best regards

---

<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:** [December 11, 2019, 11:32am UTC](https://discuss.elastic.co/t/filebeat-merge-several-lines-from-mysql-slow-log-into-one-line/207166/3 "2019-12-11T11:32:37Z")

</div>

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