# Parse XML Using Logstash

**URL:** <https://discuss.elastic.co/t/parse-xml-using-logstash/146623>\
**Category:** Logstash\
**Created:** [August 30, 2018, 5:41am UTC](https://discuss.elastic.co/t/parse-xml-using-logstash/146623 "2018-08-30T05:41:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vivek\_Sharma](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vivek_sharma/32/46948_2.png) [@Vivek\_Sharma](https://discuss.elastic.co/u/Vivek_Sharma)\
**Post date:** [August 30, 2018, 5:41am UTC](https://discuss.elastic.co/t/parse-xml-using-logstash/146623/1 "2018-08-30T05:41:01Z")

</div>

Hi

I have a XML in below format:

> ```
> <OrderEvent actionCode = "5">
> <OrderNumber>ORD12345</OrderNumber>
> <VendorNumber>V11111</VendorNumber>
> </OrderEvent>
> 
> ```

Filebeat picks up this xml and sends to logstash.

In logstash, I have below code for XML filter plugin.

> ```
> xml {
> source => "message"
> store_xml => true
> namespaces => {
> "xsl" => "http://www.w3.org/1999/XSL/Transform"
> "xhtml" => "http://www.w3.org/1999/xhtml"
> }
> }
> 
> ```

When I view the results on Kibana, I am not getting the results properly. Although it is picking up the XML. But the values which I require are different.

Values displayed on Kibana are:

- 

```
 <OrderEvent actionCode = "5">

```

- 

```
  <OrderNumber>ORD12345</OrderNumber>

```

- 

```
 <VendorNumber>V11111</VendorNumber>

```

But values which I want to get is:

> Field Name: actionCode and value = 5  
> Field Name: OrderNumber and value = ORD12345  
> Field Name: VendorNumber and value = V11111

Can anyone please help.

Thanks

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [August 30, 2018, 6:04am UTC](https://discuss.elastic.co/t/parse-xml-using-logstash/146623/2 "2018-08-30T06:04:39Z")

</div>

On the Filebeat side you need to use a multiline configuration to join all lines of the file into a single event. Examples of how this can be done has been posted in the past.

---

<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:** [September 27, 2018, 6:04am UTC](https://discuss.elastic.co/t/parse-xml-using-logstash/146623/3 "2018-09-27T06:04:50Z")

</div>

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