# Help needed to filter unwanted charators from kafka message in logstash

**URL:** <https://discuss.elastic.co/t/help-needed-to-filter-unwanted-charators-from-kafka-message-in-logstash/103203>\
**Category:** Logstash\
**Created:** [October 9, 2017, 9:38am UTC](https://discuss.elastic.co/t/help-needed-to-filter-unwanted-charators-from-kafka-message-in-logstash/103203 "2017-10-09T09:38:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rameswar\_m](https://avatars.discourse-cdn.com/v4/letter/r/bc79bd/32.png) [@Rameswar\_m](https://discuss.elastic.co/u/Rameswar_m)\
**Post date:** [October 9, 2017, 9:38am UTC](https://discuss.elastic.co/t/help-needed-to-filter-unwanted-charators-from-kafka-message-in-logstash/103203/1 "2017-10-09T09:38:44Z")

</div>

hi ,  
i am new to logstash , i am trying to pull the dta from mongo to kibana via logstash  
from kafka i am getting message below and my logstash conf is :

message:

�{"\_id" : {"$oid" : "59da4346140f1dc01e861e4b"},"name" : "Boston","loc" : {"type" : "Point","coordinates" : [71.0603, 42.3583]}}rs0rs0pTracer.port��ҝ��͊�é�c�����W

i have used below filter:

filter{

mutate {

```
gsub => [
   "message", "rs0", "",
   #"message", "c", "",
   #"message", "W", "",
   "message", "pTracer.port", "",
   "message", "[^0-9A-Za-z\:\{\}\"\,]/", ""  
]

```

}

data is comings as :

�{"\_id" : {"$oid" : "59da464d140f1dc01e861e4c"},"name" : "FED","loc" : {"type" : "Point","coordinates" : [51.8781, 176.6461]}}��ҝ������с�c�����W

i need data like this:

{"\_id" : {"$oid" : "59da3ace140f1dc01e861e49"},"name" : "FED","loc" : {"type" : "Point","coordinates" : [51.8781, 176.6461]}}

---

<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 6, 2017, 9:38am UTC](https://discuss.elastic.co/t/help-needed-to-filter-unwanted-charators-from-kafka-message-in-logstash/103203/2 "2017-11-06T09:38:49Z")

</div>

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