Parse xml with logstash

Hi All,Here is my xml,I want to parse this xml, how can I parse it?

<?xml version="1.0" encoding="UTF-8"?>

<holding_stock msgnum="3480">
<user_id>10028603</user_id>
********
<pos_str>0</pos_str>
<request_num>1000</request_num>
0
</holding_stock>

If you ingest that as a single event then you can parse it using an xml filter

xml { source => "message" target => "theXML" }

results in

    "theXML" => {
         "msgnum" => "3480",
        "content" => [
        [0] "\n",
        [1] "\n********\n",
        [2] "\n",
        [3] "\n0\n"
    ],
        "user_id" => [
        [0] "10028603"
    ],
        "pos_str" => [
        [0] "0"
    ],
    "request_num" => [
        [0] "1000"
    ]
},

Thank you, add xpath to parse out what I want!

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