# Filebeat Process multilne XML

**URL:** <https://discuss.elastic.co/t/filebeat-process-multilne-xml/77761>\
**Category:** Beats\
**Created:** [March 8, 2017, 5:28am UTC](https://discuss.elastic.co/t/filebeat-process-multilne-xml/77761 "2017-03-08T05:28:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sourabh\_Narang](https://avatars.discourse-cdn.com/v4/letter/s/df788c/32.png) [@Sourabh\_Narang](https://discuss.elastic.co/u/Sourabh_Narang)\
**Post date:** [March 8, 2017, 5:28am UTC](https://discuss.elastic.co/t/filebeat-process-multilne-xml/77761/1 "2017-03-08T05:28:55Z")

</div>

I have a log file where I am printing request and response XML bodies. This log file also has some additional lines that are not XML. Example below --

```
 ===========================================
<request>
  <data>
     abc
</data>
</request>
some random lines concerning the processing of request..
fha;js;fkgak;gj;kj;a
jgahkg;gaj;
Now response follows 
<response>
    <output>
    def
 </output>
</response>
===================================================

```

How to use use filebeat multiline feature to parse such a data and have each XML as a single event to be sent to logstash?

---

<div class="post-metadata">

**Author:** ![helloworld](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/helloworld/32/33768_2.png) [@helloworld](https://discuss.elastic.co/u/helloworld)\
**Post date:** [March 8, 2017, 9:09am UTC](https://discuss.elastic.co/t/filebeat-process-multilne-xml/77761/2 "2017-03-08T09:09:04Z")

</div>

I also faced this problem once. I couldn't find the solution. Modifying the log file at the source is one such option. But not always recommended.

---

<div class="post-metadata">

**Author:** ![andrewkroh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrewkroh/32/3784_2.png) [@andrewkroh](https://discuss.elastic.co/u/andrewkroh)\
**Post date:** [March 11, 2017, 12:29am UTC](https://discuss.elastic.co/t/filebeat-process-multilne-xml/77761/3 "2017-03-11T00:29:12Z")

</div>

I don't think this can be done with Filebeat alone.

One approach would be to use multiline in Filebeat to group all the lines from the request and response into one event.

```auto
filebeat.prospectors:
  - paths: ['/my/file.log']
    multiline.pattern: ^<request>
    multiline.negate: true
    multiline.match: after

```

Then in either [Logstash](https://www.elastic.co/guide/en/logstash/current/plugins-filters-grok.html) or [Ingest Node](https://www.elastic.co/guide/en/elasticsearch/reference/current/grok-processor.html), use grok to parse the request, response, and text about the request into separate fields.

And after grok'ing out the request and response you could apply an [xml](https://www.elastic.co/guide/en/logstash/current/plugins-filters-xml.html) filter to parse those messages.

---

<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:** [March 29, 2017, 5:29am UTC](https://discuss.elastic.co/t/filebeat-process-multilne-xml/77761/4 "2017-03-29T05:29:20Z")

</div>

This topic was automatically closed after 21 days. New replies are no longer allowed.
