Logstash 7.1.1 - Any quote symbol except ' and " for ruby code?

Hello all!
I'm trying to pass obtained by grok variable data into ruby code filter and I need to do that in double quotas of plain ruby code which contain 'somestring' that I would like to concatenate with my variable. So, there are several issues like grok to ruby data transmit and concatenation. I haven't found a solution over the internet using ruby code filter without external script. Please, help.
Thank you for your assistance!

Can you describe this a little more? I normally use single quotes for the code option on the ruby filter so that I can use double quotes (and string interpolation) in the code block.

Ignoring the grok, what do you want to do with which fields in the ruby code?

I'm filling the ruby Net::HTTP post(uri, data, headers) like this in filter:
ruby {
code => "
data = '{'key':'valuefrommessage'}'


If I'm writing something like #{[groked]} instead of valuefrommessage then logstash print it as is without value replacement.

Right, because string interpolation only happens inside of double quoted strings. I think you will have to concatenate different parts of the string instead of using interpolation.

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