# Multiline and '\\n' extra character

**URL:** <https://discuss.elastic.co/t/multiline-and-n-extra-character/159485>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [December 5, 2018, 8:44am UTC](https://discuss.elastic.co/t/multiline-and-n-extra-character/159485 "2018-12-05T08:44:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![trelo](https://avatars.discourse-cdn.com/v4/letter/t/e19adc/32.png) [@trelo](https://discuss.elastic.co/u/trelo)\
**Post date:** [December 5, 2018, 8:44am UTC](https://discuss.elastic.co/t/multiline-and-n-extra-character/159485/1 "2018-12-05T08:44:06Z")

</div>

Hi,

I successfully turned my multiline log into single line, but now this log has ' **\n**' character and double quotes are also escaped - **"**.  
Any solution how to stop this behavior and configure filebeat to join lines " **as is**"?  
I want filebeat only join lines and send logs to logstash(ELK) where they will be split by grok filter.

\*English is not my first language, sorry.

**result:**

```auto
{"@timestamp":"2018-12-05T08:17:31.572Z","@metadata":{"beat":"filebeat","type":"doc","version":"6.4.3"},"source":"/tmp/testdata","prospector":{"type":"log"},"input":{"type":"log"},"host":{"name":"srv-hv2"},"beat":{"version":"6.4.3","name":"srv-hv2","hostname":"srv-hv2"},"offset":0,"message":"{20181004025706,N,\n{0,0},18,0,4,28331,2,I,\"\",0,\n{\"D\",\n{2,\n{\"C\",\"ax\"}\n}\n},\"\",1,41,41,353557112,0,\n{0}\n}}

```

**filebeat.yml:**

```auto
--- 
filebeat.inputs: 
  - 
    enabled: true
    multiline.match: after
    multiline.pattern: "^{%{DATESTAMP_EVENTLOG}"
    multiline.negate: true
# multiline.flush_pattern: "^},"
    paths: 
      - /tmp/testdata
    type: log

output.console: 
  pretty: false

```

---

<div class="post-metadata">

**Author:** ![steffens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/steffens/32/79630_2.png) [@steffens](https://discuss.elastic.co/u/steffens)\
**Post date:** [December 5, 2018, 3:41pm UTC](https://discuss.elastic.co/t/multiline-and-n-extra-character/159485/2 "2018-12-05T15:41:58Z")

</div>

```auto
{"@timestamp":"2018-12-05T08:17:31.572Z","@metadata":{"beat":"filebeat","type":"doc","version":"6.4.3"},"source":"/tmp/testdata","prospector":{"type":"log"},"input":{"type":"log"},"host":{"name":"srv-hv2"},"beat":{"version":"6.4.3","name":"srv-hv2","hostname":"srv-hv2"},"offset":0,"message":"{20181004025706,N,\n{0,0},18,0,4,28331,2,I,\"\",0,\n{\"D\",\n{2,\n{\"C\",\"ax\"}\n}\n},\"\",1,41,41,353557112,0,\n{0}\n}}

```

This is the json representation of your event. When sending to Logstash, it will be parsed by logstash. The `\n` is a placeholder of a line break and the `\"` will be parsed into an `"` character.

Logstash will see/process the original multiline event has is. If the line break is a problem: One can use the translate or other filters in LS to remove the line breaks. Plus, grok is based on regular expressions. One can use `\n` or `\R` to match newlines in grok patterns.

---

<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:** [January 2, 2019, 3:42pm UTC](https://discuss.elastic.co/t/multiline-and-n-extra-character/159485/3 "2019-01-02T15:42:08Z")

</div>

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