Xml can't be parsed!

hi
Here are my xml data and logstash conf.The entire event is entered when the data is entered into logstash;I'm trying to parse xml files with the xpath plugin but it doesn't give me any result!

<holding_stock_response msgnum="8">
<result>1</result>
<stock_qty>10</stock_qty>
<records>
<row pos_str="00100000P000011210000BABA" market_code="USA" stock_code="BABA" stock_name="Alibaba Group Holding Limited American D" qty="1110.000000" qty_use="1110.000000" qty_onhold="0.000000" cost_price="167.72287400" av_buy_price="167.72287000" price="110.00000000" real_buy_amount="0.000000" real_sell_amount="0.000000" sum_buy_amount="" sum_sell_amount="" correct_amount=""/>
<row pos_str="00100000K0000112100077700" market_code="HKG" stock_code="77700" stock_name="QQ RIGHT" qty="11000.000000" qty_use="11000.000000" qty_onhold="0.000000" cost_price="0.00000000" av_buy_price="0.00000000" price="0.00000000" real_buy_amount="0.000000" real_sell_amount="0.000000" sum_buy_amount="" sum_sell_amount="" correct_amount=""/>
<row pos_str="00100000K0000112100044048" market_code="HKG" stock_code="44048" stock_name="44048" qty="100000.000000" qty_use="100000.000000" qty_onhold="0.000000" cost_price="0.00000000" av_buy_price="0.00000000" price="0.00000000" real_buy_amount="0.000000" real_sell_amount="0.000000" sum_buy_amount="" sum_sell_amount="" correct_amount=""/>
</records>
xml {
        source => "message"
        target => "XML"
        store_xml => false
        remove_namespaces => "true"
        xpath => [
 "/holding_stock_response/@msgnum","msgnum",
 "/result/text()","result",
 "/stock_qty/text()","stock_qty",
 "/row/@pos_str","pos_str",
 "/row/@market_code","market_code",
 "/row/@stock_code","stock_code",
 "/row/@stock_name","stock_name",
 "/row/@qty","qty",
 "/row/@qty_use","qty_use",
 "/row/@qty_onhold","qty_onhold",
 "/row/@av_buy_price","av_buy_price",
 "/row/@price","price",
 "/row/@real_buy_amount","real_buy_amount",
 "/row/@real_sell_amount","real_sell_amount",
 "/row/@sum_buy_amount","sum_buy_amount",
 "/row/@sum_sell_amount","sum_sell_amount",
 "/row/@correct_amount","correct_amount"
        ]
}

Is something wrong with my conf ? What should I do? Thanks for helping!

Hi,

This forum is targeted to Portuguese only, please let me in know if you speak Portuguese, otherwise I'll move your post to the proper category

Thanks

Sorry, I have changed!

With that XML and that xml filter I get

    "msgnum" => [
    [0] "8"
],

If you add

</holding_stock_response>

at the end then everything else gets parsed.

Thanks your help!

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