# How to parse this xml data each rate plan id data should go to new row or new column dynamically by using xml filter xpath option or any other solution let me know please (edited)

**URL:** <https://discuss.elastic.co/t/how-to-parse-this-xml-data-each-rate-plan-id-data-should-go-to-new-row-or-new-column-dynamically-by-using-xml-filter-xpath-option-or-any-other-solution-let-me-know-please-edited/238073>\
**Category:** Logstash\
**Created:** [June 22, 2020, 11:30am UTC](https://discuss.elastic.co/t/how-to-parse-this-xml-data-each-rate-plan-id-data-should-go-to-new-row-or-new-column-dynamically-by-using-xml-filter-xpath-option-or-any-other-solution-let-me-know-please-edited/238073 "2020-06-22T11:30:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Puneeth\_S\_B\_Gowda1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/puneeth_s_b_gowda1/32/68544_2.png) [@Puneeth\_S\_B\_Gowda1](https://discuss.elastic.co/u/Puneeth_S_B_Gowda1)\
**Post date:** [June 22, 2020, 11:30am UTC](https://discuss.elastic.co/t/how-to-parse-this-xml-data-each-rate-plan-id-data-should-go-to-new-row-or-new-column-dynamically-by-using-xml-filter-xpath-option-or-any-other-solution-let-me-know-please-edited/238073/1 "2020-06-22T11:30:04Z")

</div>

![image](https://us1.discourse-cdn.com/elastic/original/3X/b/7/b7f9ddd291848559587a249e11b8693e18857b63.png)

my logstash

input { beats { port =\> 5044 } }  
filter {  
mutate {  
split =\> { "message" =\> "@$@" }}

mutate {  
add\_field =\> { "response" =\> "%{[message][1]}" "request" =\> "%{[message][0]}" } }

xml { store\_xml =\> "false" source =\> "response" target =\> "xmldata"

xpath =\>[  
"/propertyAvailability/hotelRates/hotel/bookingChannel/ratePlan[1]/@id","ratePlan id",  
"/propertyAvailability/hotelRates/hotel/bookingChannel/ratePlan[1]/roomDetails/roomTypeCode/metricValue/text()","roomTypeCode",  
"/propertyAvailability/hotelRates/hotel/bookingChannel/ratePlan[1]/roomDetails/hhRoomType/text()","hhRoomType",  
"/propertyAvailability/hotelRates/hotel/bookingChannel/ratePlan[1]/roomDetails/hhBedTypes/hhBedType/text()","hhBedTypes",  
"/propertyAvailability/hotelRates/hotel/bookingChannel/ratePlan[1]/rateDetails/rateTypeCode/text()","rateTypeCode",  
"/propertyAvailability/hotelRates/hotel/bookingChannel/ratePlan[1]/rateDetails/breakfastIncluded/text()","breakfastincluded",  
"/propertyAvailability/hotelRates/hotel/bookingChannel/ratePlan[1]/rateDetails/nonRefundable/text()","nonRefundable",  
"/propertyAvailability/hotelRates/hotel/bookingChannel/ratePlan[1]/roomRateDetails/roomRateCode/text()","roomRateCode",  
"/propertyAvailability/hotelRates/hotel/bookingChannel/@type","bookingChannel"

] } }

output { elasticsearch { hosts =\> ["[http://localhost:9200](http://localhost:9200)"] index =\> "hotelhubatpingdev" } }

my file beat

filebeat.inputs:

- type: log

filebeat.config.modules:

path: ${path.config}/modules.d/\*.yml

reload.enabled: false

setup.template.settings:  
index.number\_of\_shards: 1

setup.kibana:

host: "192.168.100.136:5601"

output.logstash:

hosts: ["192.168.100.136:5044"]

processors:

- add\_host\_metadata: ~
- add\_cloud\_metadata: ~
- add\_docker\_metadata: ~
- add\_kubernetes\_metadata: ~

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/6/5/653c1dddc8e480f41e0e45c897efb77efcea9e2e.png)

---

<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:** [July 20, 2020, 11:30am UTC](https://discuss.elastic.co/t/how-to-parse-this-xml-data-each-rate-plan-id-data-should-go-to-new-row-or-new-column-dynamically-by-using-xml-filter-xpath-option-or-any-other-solution-let-me-know-please-edited/238073/2 "2020-07-20T11:30:17Z")

</div>

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