Setting the value of variable in ruby logstash

Just remove the line I've pointed.

if "el5" in [message] {
    ruby {
    init => "@@linuxversion='5'"
    code => "
        event.set('linux',@@linuxversion)
        puts linux <--- this line is the issue
    "
    }
    drop {}
}

Also, why are you using a drop just after the ruby filter? It will discard the event althogether.