fluent-plugin-rewrite icon indicating copy to clipboard operation
fluent-plugin-rewrite copied to clipboard

How do I replace all \n to literally a new line

Open ivankennethwang opened this issue 7 years ago • 2 comments

My log includes a "\n" as string, can I use this plugin to replace it to a legit newline before sending to my output (ex: elasticsearch)?

<filter **>
  @type rewrite
  <rule>
    key     log
    pattern \\n
    replace \n
  </rule>
</filter>

ivankennethwang avatar Nov 01 '17 07:11 ivankennethwang

Or how do you prevent escaping

pattern \\
replace \

Seems like after replacing, it's also escaping it and that's why the result is still double backslash

ivankennethwang avatar Nov 01 '17 10:11 ivankennethwang

Would you send a pr?

kentaro avatar Nov 01 '17 11:11 kentaro