Ruby Iteration in Logstash help

OK, I am unclear on what output format you want. Also, if the arrays are all ordered lists then we can make assumptions and ignore the value of p. The following code does no error checking, makes assumptions about your data format, and I apologize if my ruby coding style makes anyone's eyeballs bleed, but it should give you an idea of what your code would need to do...

    xml { source => "message" target => "[@metadata][theXML]" force_array => false }
    ruby {
        code => '
            xml = event.get("[@metadata][theXML]")
            types = xml["measType"]
            values = xml["measValue"]
            a = []
            values.each { |x|
                h = {}
                h["measObjLdn"] = x["measObjLdn"]
                x["r"].each_index { |i|
                    h[types[i]["content"]] = x["r"][i]["content"]
                }
                a << h
            }
            event.set("data", a)
        '
    }

will produce

      "data" => [
    [0] {
                  "VS.MemUsedSize" => "26777.00",
             "VS.MemAvailableSize" => "361.00",
                      "measObjLdn" => "PoolType=necc, PoolId=0, PoolMember=0, Machine=XXXXXX1, UUID=ABCDABCD1",
        "VS.ScdrsTranferredOverBp" => "0",
                 "VS.swapMemUsage" => "100.00"
    },
    [1] {
                  "VS.MemUsedSize" => "20214.00",
             "VS.MemAvailableSize" => "312.00",
                      "measObjLdn" => "PoolType=necc, PoolId=0, PoolMember=1, Machine=XXXXXX2, UUID=ABCDABCD2",
        "VS.ScdrsTranferredOverBp" => "0",
                 "VS.swapMemUsage" => "100.00"
    },
    [2] {
                  "VS.MemUsedSize" => "18203.00",
             "VS.MemAvailableSize" => "15213.00",
                      "measObjLdn" => "PoolType=necc, PoolId=0, PoolMember=2, Machine=XXXXXX3, UUID=ABCDABCD3",
        "VS.ScdrsTranferredOverBp" => "0",
                 "VS.swapMemUsage" => "100.00"
    }
],