Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as JSON by logstash13 ( 6 years ago )
input
{
    file
        {
            path => "/home/test.xml"
            start_position => "beginning"
            sincedb_path => "/dev/null"
            type => "xml"
            codec => multiline {
                    pattern => "<\?xml "
                    negate => "true"
                    what => "previous"
                }
        }
}

filter {
     mutate {
         gsub => [ "message", "[\t\r\n]", "" ]
     }

    xml{
        source => "message"
        store_xml => true
        target => "return"
        xpath => [
            "/return/items/item/@id"                , "id"                   ,
            "/return/items/item/@advertiserId"      , "advertiserId"         ,
            "/return/items/item/@saleAmount"        , "saleAmount"           ,
            "/return/items/item/@commissionAmount"  , "commissionAmount"     ,
            "/return/items/item/@advertiserName"    , "advertiserName"
        ]
    }
}

output{

   elasticsearch{
           hosts => ["http://localhost:9200/"]
           index => "parse_xml"
       }
    stdout
    {
        codec => rubydebug
    }
}

 

Revise this Paste

Your Name: Code Language: