Filtering binary data from an ASCII string


(P4w4n) #1

Hi,

I have a mainframe log with message containing some binary data. I would like to trim that binary data in Logstash before sending it to elasticsearch. I am not able to find a way. Below is the sample data that I am getting:

"\u0000\u0000\u0000C\u0000 \u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000{"response":{"message":"Hello World"}}"

I want to trim all the data before {"response":{"message":"Hello World"}}"

can someone please help.

thanks,
Pawan


(Magnus B├Ąck) #2

You might be able to use a mutate filter's gsub option to remove all leading non-printable characters. Otherwise you can write some Ruby code in a ruby filter.


(system) #3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.