# Logstash masking logs syntax

**URL:** <https://discuss.elastic.co/t/logstash-masking-logs-syntax/325699>\
**Category:** Logstash\
**Created:** [February 16, 2023, 7:57am UTC](https://discuss.elastic.co/t/logstash-masking-logs-syntax/325699 "2023-02-16T07:57:37Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![furkano](https://avatars.discourse-cdn.com/v4/letter/f/e9c0ed/32.png) [@furkano](https://discuss.elastic.co/u/furkano)\
**Post date:** [February 20, 2023, 5:32am UTC](https://discuss.elastic.co/t/logstash-masking-logs-syntax/325699/4 "2023-02-20T05:32:58Z")

</div>

I want to use filter like this

> [@Find and replace string in \[message\] field](https://discuss.elastic.co/t/find-and-replace-string-in-message-field/96319/5):
>
> You'd have to use a ruby filter for this.

"Is there a way i can do the following using logstash filters:  
I have an ID stored in a field example id: 123456789.  
I want to replace first 5 digits with an 'x'. so that id looks like, id:xxxxx6789.  
How can i do this in logstash filters?"

---

_[View the full topic](https://discuss.elastic.co/t/logstash-masking-logs-syntax/325699)._
