Error escaping slash

I'm using, logstash 8.9.1 or version 7.14.1, with pipelines managed by kibana in version 8, and 7 with local configuration, having the same result

I have this config to remove \ from the message:

mutate {
        gsub => ["message","[\\]","" ]
      }

but i'm getting this error:

:exception=>#<RegexpError: premature end of char-class: /[\]/>

I tried \[\\\] to scape [ ] charachters, runs, but doesn't match with \

could any test?

Hi @Daniel_Lopez

perhaps try

gsub => ["message","[\\\\]","" ]

    gsub => ["message","[\\]","" ]

That works for me with a local configuration for logstash 8.9. I wonder if something in centralized pipeline management is eating the escape.

I cheated and did not really try logstash I did a quick test with the ingest pipeline gsub .. which did not work as shown but did work with the 4 \... Now curious what's going on?

I though i tested it, it is working with [\\\\], thanks a lot guys

1 Like

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