Xml attribute PARSING IN LOGSTASH

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

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"]
index => "10jun2"
#user => "elastic"
#password => "changeme"
}
}

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