# Adding XXXX in a column through logstash

**URL:** <https://discuss.elastic.co/t/adding-xxxx-in-a-column-through-logstash/224837>\
**Category:** Logstash\
**Created:** [March 24, 2020, 12:51pm UTC](https://discuss.elastic.co/t/adding-xxxx-in-a-column-through-logstash/224837 "2020-03-24T12:51:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sagar\_Mandal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sagar_mandal/32/57073_2.png) [@Sagar\_Mandal](https://discuss.elastic.co/u/Sagar_Mandal)\
**Post date:** [March 24, 2020, 12:51pm UTC](https://discuss.elastic.co/t/adding-xxxx-in-a-column-through-logstash/224837/1 "2020-03-24T12:51:14Z")

</div>

Hi Team,

I have this task where I'm inputing some csv data which contain Accc number, which is 10 digit long. so what i want to do is that before storing it into elasticsearch, I want to change the end 5 digit to X.

so it will look like this

1234567890

changes into

12345xxxxx

I know it can be done. just need a headsup.  
do help

Thanks and Regards,  
Sagar Mandal

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [March 24, 2020, 2:48pm UTC](https://discuss.elastic.co/t/adding-xxxx-in-a-column-through-logstash/224837/2 "2020-03-24T14:48:20Z")

</div>

Use mutate

```
mutate { gsub => ["someField", "[0-9]{5}$", "xxxxx" ] }
```

---

<div class="post-metadata">

**Author:** ![Sagar\_Mandal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sagar_mandal/32/57073_2.png) [@Sagar\_Mandal](https://discuss.elastic.co/u/Sagar_Mandal)\
**Post date:** [March 24, 2020, 2:51pm UTC](https://discuss.elastic.co/t/adding-xxxx-in-a-column-through-logstash/224837/3 "2020-03-24T14:51:07Z")

</div>

Thanks buddy  
I'll try this

---

<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:** [April 21, 2020, 2:51pm UTC](https://discuss.elastic.co/t/adding-xxxx-in-a-column-through-logstash/224837/4 "2020-04-21T14:51:09Z")

</div>

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