Rename snmp dynamic fields

Try

    ruby {
        code => '
            event.to_hash.each { |k, v|
                if k =~ /^(ifDescr|ifInDiscards|ifInErrors|ifInOctects|ifOperStatus|ifOutDiscards|ifOutErrors|ifOutErrors|ifOutOctects)/
                    newk = k.gsub(/\.[0-9]+$/, "")
                    event.set(newk, v)
                    event.remove(k)
                end
            }
        '
    }

The if statement is probably optional.