# Wich is the best way to parse logs with XML seccion

**URL:** https://discuss.elastic.co/t/wich-is-the-best-way-to-parse-logs-with-xml-seccion/179556
**Category:** Logstash
**Created:** [May 3, 2019, 3:14pm UTC](https://discuss.elastic.co/t/wich-is-the-best-way-to-parse-logs-with-xml-seccion/179556 "2019-05-03T15:14:14Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![fcalegari](https://avatars.discourse-cdn.com/v4/letter/f/b9bd4f/32.png) [@fcalegari](https://discuss.elastic.co/u/fcalegari)
#### Post date: [May 3, 2019, 3:14pm UTC](https://discuss.elastic.co/t/wich-is-the-best-way-to-parse-logs-with-xml-seccion/179556/1 "2019-05-03T15:14:14Z")

</div>

Hi , I'm triying to send a app log to logatash, the problem is that this logs have XML sections in multilines.

example:

2019-05-03 12:11:36,746 [xxxxxxxxx] INFO Command - GetReport Command receive, Id [xxxxxxxxxx], response and end  
2019-05-03 12:11:38,939 [xxxxxxxxx] INFO ProvisioningManager - ProvisioningManager command receive  
2019-05-03 12:11:38,940 [xxxxxxxxx] INFO Command - WebService message receive [\<?xml version="1.0" encoding="UTF-8"?\>\<soapenv:Envelope xmlns:soapenv="[http://schemas.xmlsoap.org/soap/envelope/](http://schemas.xmlsoap.org/soap/envelope/)"\>soapenv:Body\<ns1:executeAsynchronousCommand xmlns:ns1="[http://pm.soap.pm.gemalto.com](http://pm.soap.pm.gemalto.com)"\>ns1:filenamepm\</ns1:filename\>ns1:token\</ns1:token\>ns1:command

```
             <Order>
               <DeleteSubscription
                  iccid="xxxxxxxxxxxxxxxxxxx"
                  deleteSecurity="true">
               </DeleteSubscription>
             </Order>

           </ns1:command></ns1:executeAsynchronousCommand></soapenv:Body></soapenv:Envelope>]

```

2019-05-03 12:11:38,940 [xxxxxxxxx] INFO Command - ASynchronus Command receive, will parse command, generate Id, response and end

Which is the best way to do it?

thanks

---

<div class="post-metadata">

### Author: ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)
#### Post date: [May 3, 2019, 6:01pm UTC](https://discuss.elastic.co/t/wich-is-the-best-way-to-parse-logs-with-xml-seccion/179556/2 "2019-05-03T18:01:25Z")

</div>

You could try something like

```
if "xml" in [message] {
        dissect { mapping => { "message" => "%{}[%{}]%{}[%{[@metadata][xml]}]%{}" } }
}

```

Then if the XML is valid (what you have shown is not) you could parse it with an xml filter

```
xml { source => "[@metadata][xml]" target => "theXML" }
```

---

<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 31, 2019, 6:01pm UTC](https://discuss.elastic.co/t/wich-is-the-best-way-to-parse-logs-with-xml-seccion/179556/3 "2019-05-31T18:01:26Z")

</div>

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