# Xml attribute parsing through Logstash + file beat

**URL:** <https://discuss.elastic.co/t/xml-attribute-parsing-through-logstash-file-beat/236435>\
**Category:** Logstash\
**Created:** [June 10, 2020, 5:18am UTC](https://discuss.elastic.co/t/xml-attribute-parsing-through-logstash-file-beat/236435 "2020-06-10T05:18:42Z")\
**Posts on this page:** 3\
**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 10, 2020, 5:18am UTC](https://discuss.elastic.co/t/xml-attribute-parsing-through-logstash-file-beat/236435/1 "2020-06-10T05:18:42Z")

</div>

This is my xml

\<OTA\_HotelAvailRS\>M1S\</OTA\_HotelAvailRS\>

from above one i need M2S attribute value as new column in Kibana

Can you share sample conf which will help for my above xml please

My xml is from text file

input {  
beats {  
port =\> 5044  
}  
}  
filter {  
csv {  
separator =\> "@$@"  
columns =\> ["date","est\_cd","hotelhubcode","sessionid","searchid","requestid","request","response","parentmethodname","starttime","endtime","duration","exception","notes","channelpropertyid"]  
}  
xml {  
store\_xml =\> "false"  
source =\> "response"  
remove\_namespaces =\> "true"  
xpath =\>[  
"/OTA\_HotelAvailRS/RoomType/@RoomType/text()","RoomType"  
]  
}  
}  
output {  
elasticsearch {  
hosts =\> ["[http://localhost:9200](http://localhost:9200)"]  
index =\> "4jun9"  
#user =\> "elastic"  
#password =\> "changeme"  
}  
}

---

<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 10, 2020, 9:34am UTC](https://discuss.elastic.co/t/xml-attribute-parsing-through-logstash-file-beat/236435/2 "2020-06-10T09:34:23Z")

</div>

Working great for me with following log stash changes

input {  
beats {  
port =\> 5044  
}  
}  
filter {  
xml {  
store\_xml =\> "false"  
source =\> "message"  
remove\_namespaces =\> "true"

xpath =\>[  
"/propertyAvailability/hotelRates/hotel/bookingChannel/ratePlan/roomDetails/hhBedTypes/hhBedType/@hhBedType","hhBedType"  
]  
}  
}

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

---

<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 8, 2020, 9:34am UTC](https://discuss.elastic.co/t/xml-attribute-parsing-through-logstash-file-beat/236435/3 "2020-07-08T09:34:24Z")

</div>

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