How extract data with logstash filter xml from a complex xml

Hello, I need to extract the data returned from an xml in an http input

The xml Returned is:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<model-response-list xmlns="http://www.example.com" total-models="1" throttle="1" error="EndOfResults">
    <model-responses>
        <model xx="0x12345">
            <attribute id="0x1212e">FIELD I WANT</attribute>
            <attribute id="0x1219f">FIELD I WANT</attribute>
            <attribute id="0x23454">FIELD I WANT</attribute>
            <attribute-list id="0x12zaq">
                <instance oid="2" value="11"/>
            </attribute-list>
            <attribute-list id="0x12ac6">
                <instance oid="1" value="65"/>
                <instance oid="14" value="100"/>
            </attribute-list>
        </model>
    </model-responses>
</model-response-list>

In addition to these fields, I need the values ​​of these

oid="2" value="11"
oid="14" value="100"

My logstash conf is:

input{
http_poller{
        urls => {
                urlname => "http://192.168.56.101:8081/request"
        }
        request_timeout => 60
        schedule => {every => "3s"}
        codec => line
 }
}

filter {
        xml {
           store_xml => false
           source => "message"
           remove_namespaces => true
           xpath =>[ "/model-response-list/model-responses/model/attribute", "FIELDRETRIEVEONE"]

        
}
}
output{
elasticsearch{
        hosts => ["192.168.56.102:9200"]
        index => "logstash_http_poller"
}
stdout { codec => rubydebug }
}

I can get the first value, but the next I couldn't. Can anybody help me?
Thank you very much!

Please do not post pictures of text, just post the text.

I solved my problem forcing the response be a json file

headers => {
			Accept => "application/json"
		}

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