# Xml attribute PARSING IN LOGSTASH

**URL:** <https://discuss.elastic.co/t/xml-attribute-parsing-in-logstash/236307>\
**Category:** Logstash\
**Created:** [June 9, 2020, 9:55am UTC](https://discuss.elastic.co/t/xml-attribute-parsing-in-logstash/236307 "2020-06-09T09:55:50Z")\
**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 9, 2020, 9:55am UTC](https://discuss.elastic.co/t/xml-attribute-parsing-in-logstash/236307/1 "2020-06-09T09:55:50Z")

</div>

```
Hi

I am looking for xml attribute parsing through Logstash + file beat

This is my xml
<OTA_HotelAvailRS><RoomType RoomType="M2S">M1S</RoomType></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"]
    index => "4jun9"
    #user => "elastic"
    #password => "changeme"
  }
}
    indent preformatted text by 4 spaces
```

---

<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 11, 2020, 8:51am UTC](https://discuss.elastic.co/t/xml-attribute-parsing-in-logstash/236307/2 "2020-06-11T08:51:58Z")

</div>

# Sample Logstash configuration for creating a simple

# Beats -\> Logstash -\> Elasticsearch pipeline.

input {  
beats {  
port =\> 5044  
}  
}

filter {

# csv {

#separator =\> "@$@"  
#columns =\> ["response"]  
#}

xml {  
store\_xml =\> "false"  
source =\> "message"  
remove\_namespaces =\> "true"

xpath =\>[  
"/OTA\_HotelAvailRS/RoomStays/RoomStay/RoomTypes/RoomType/@RoomType","RoomType"  
]  
}

}

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

---

<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 9, 2020, 8:52am UTC](https://discuss.elastic.co/t/xml-attribute-parsing-in-logstash/236307/3 "2020-07-09T08:52:06Z")

</div>

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