# Can we parse XML data without giving xpath details using logstash?

**URL:** https://discuss.elastic.co/t/can-we-parse-xml-data-without-giving-xpath-details-using-logstash/283128
**Category:** Logstash
**Created:** [September 2, 2021, 6:35am UTC](https://discuss.elastic.co/t/can-we-parse-xml-data-without-giving-xpath-details-using-logstash/283128 "2021-09-02T06:35:59Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Shruti\_Gupta1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shruti_gupta1/32/78663_2.png) [@Shruti\_Gupta1](https://discuss.elastic.co/u/Shruti_Gupta1)
#### Post date: [September 2, 2021, 6:35am UTC](https://discuss.elastic.co/t/can-we-parse-xml-data-without-giving-xpath-details-using-logstash/283128/1 "2021-09-02T06:35:59Z")

</div>

Hi Team,

We are monitoring google apigee apiProxy messaging logs with ELK Stack. As we are not aware which fields will be sent by workflows in the request and response body of XML, We need help to understand how can we parse an XML without xpath details.

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: [September 2, 2021, 1:03pm UTC](https://discuss.elastic.co/t/can-we-parse-xml-data-without-giving-xpath-details-using-logstash/283128/2 "2021-09-02T13:03:00Z")

</div>

If you use an xml filter with store\_xml set to true and omit the xpath option then it will parse arbitrary XML structures.

---

<div class="post-metadata">

### Author: ![Shruti\_Gupta1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shruti_gupta1/32/78663_2.png) [@Shruti\_Gupta1](https://discuss.elastic.co/u/Shruti_Gupta1)
#### Post date: [September 3, 2021, 4:03am UTC](https://discuss.elastic.co/t/can-we-parse-xml-data-without-giving-xpath-details-using-logstash/283128/3 "2021-09-03T04:03:53Z")

</div>

Thanks Badger, When i am using below conf my logstash gets stuck.

input {  
file {  
path =\> "/etc/logstash/conf.d/file.xml"  
start\_position =\> beginning  
sincedb\_path =\> "/dev/null"  
type =\> "xml"  
codec =\> multiline {  
pattern =\> "^\<?Root .\*\>"  
negate =\> true  
what =\> "previous" }  
} }  
filter {  
xml { source =\> "message" target =\> "theXML" store\_xml =\> true }  
output {  
elasticsearch {  
hosts =\> ["[http://192.168.1.10:9200](http://192.168.1.10:9200)"]  
index =\> "demo" } }

---

<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: [October 1, 2021, 4:04am UTC](https://discuss.elastic.co/t/can-we-parse-xml-data-without-giving-xpath-details-using-logstash/283128/4 "2021-10-01T04:04:50Z")

</div>

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