Hi,
I need some help writing seemingly simple ruby code, but I can't figure out how (newbie).
At some point, my pipeline produces a field structured as follows::
   "xmldata" => {
"uplinkMessage" => {
    "constrainedData" => {
        "routeClearanceData" => {
            "RouteClearance" => {
                "routeInformations" => {
                    "publishedIdentifier" => [
                        [0] {
                            "fixName" => {
                                "name" => {
                                    "content" => "IRMAR"
                                }
                            }
                        },
                        [1] {
                            "fixName" => {
                                "name" => {
                                    "content" => "TAKES"
                                }
                            }
                        }
                    ]
                }
            }
        }
    }
I would like to reduce that collection of various fixName/name/content sub element values to a simple string: "IRMAR-TAKES-". But I can't get the ruby code right:
[2019-04-12T16:06:05,791][ERROR][logstash.filters.ruby ] Ruby exception occurred: undefined method' for nil:NilClass`
Here is my code, thanks for any suggestion.
Olive
               ruby {
                code => '
                       route=""
                       rt=event.get("[xmldata][uplinkMessage][constrainedData][routeClearanceData][RouteClearance][routeInformations][publishedIdentifier]")
                       rt.each {|key,val|
                               route << val[key]["fixName"]["name"]["content"]
                               route <<"-"
                       }
                       event.set("Value",route)
                       '
        }