# Gsub backslash escape and continue when error

**URL:** <https://discuss.elastic.co/t/gsub-backslash-escape-and-continue-when-error/253282>\
**Category:** Logstash\
**Created:** [October 26, 2020, 9:17am UTC](https://discuss.elastic.co/t/gsub-backslash-escape-and-continue-when-error/253282 "2020-10-26T09:17:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bnmtl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bnmtl/32/77109_2.png) [@bnmtl](https://discuss.elastic.co/u/bnmtl)\
**Post date:** [October 26, 2020, 9:17am UTC](https://discuss.elastic.co/t/gsub-backslash-escape-and-continue-when-error/253282/1 "2020-10-26T09:17:44Z")

</div>

Hi,

I have json input, and using codec =\> json { charset =\> "UTF-8" }

I see that logstash giving **Json::ParserError: Unrecognized character escape ''** when I am getting message below;

"incoming": "\u001Btb��01w"

I used  
json {  
skip\_on\_invalid\_json =\> true  
source =\> "message"  
remove\_field =\> ["message"]  
}  
and  
mutate {  
gsub =\> ["incoming", "[\]", "" ]  
}

But after that I see that when "incoming" has \ successfully parsed. But, if I get message below, I am getting **Json::ParserError: Unrecognized character escape 'a'**

"incoming": "\\u\u\asd\sasdm�01w"

Whats the proper way to escape all incoming backslash characters.  
And is there any way to keep working logstash when json parse error ? Because when I get json parse error, logstash stops sending data.

---

<div class="post-metadata">

**Author:** ![bnmtl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bnmtl/32/77109_2.png) [@bnmtl](https://discuss.elastic.co/u/bnmtl)\
**Post date:** [October 27, 2020, 12:01pm UTC](https://discuss.elastic.co/t/gsub-backslash-escape-and-continue-when-error/253282/2 "2020-10-27T12:01:41Z")

</div>

any comment would be perfect

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 24, 2020, 12:01pm UTC](https://discuss.elastic.co/t/gsub-backslash-escape-and-continue-when-error/253282/3 "2020-11-24T12:01:49Z")

</div>

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