How to convert hex to ascii in logstash?

Hello.

I want to convert hex data to ascii so I tried several ways on the logstash.config file.
My reference document is here. But it doesn't work for me. There's a error likes 'undefined method pack' .

My source data format example is "0b:33:22:15:32:23:11:15:76:3c" and I changed to "0b33221532231115763c" by using gsub. My problem is how to change hexstring(0b33221532231115763c) to ascii. Is there any idea or way?

Thanks.

The error is probably

 undefined method `pack' for "0b33221532231115763c":String

which occurs because the String class does not have a .pack method. .pack is a method applicable to the Array class. Thus

ruby { code => 'event.set("anotherField", event.get("someField").pack("H*"))' }

will get an exception, whereas

ruby { code => 'event.set("anotherField", [event.get("someField")].pack("H*"))' }

will produce \v3\"\x152#\x11\x15v<. That is, vertical tab (0x0b), 3, double quote (0x22) etc.