How to replace ' to " with gsub

Hi all
How can i use gsub to replace ' to become ", i need it to parse json data. So some how json can only parse data field with "" and not '' so i need to replace ' to ".

Can anyone help me

Thanks in advance

filter {
      mutate {
         gsub => [
           "message", "'", """
         ]
      }
      json {
        source => "message"
      }
 }

does this work?

nope it does not work, log say that the """ expected one of [ \\t\\r\\n ], \"\#\", \"{\", \",\", \"]\"

filter {
      mutate {
         gsub => [
           "message", "\'", "\""
         ]
      }
      json {
        source => "message"
      }
 }

try to escape characters

Well i have try to escape characters but it got worst, however luckily i manage to got it working now.
All i have to do is to enclose ' with " " and enclose " with ' ' and it work.
Still dont quite understand but it work.

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