# How to change a number

**URL:** <https://discuss.elastic.co/t/how-to-change-a-number/194832>\
**Category:** Logstash\
**Created:** [August 12, 2019, 11:05am UTC](https://discuss.elastic.co/t/how-to-change-a-number/194832 "2019-08-12T11:05:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arnodl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/arnodl/32/48837_2.png) [@Arnodl](https://discuss.elastic.co/u/Arnodl)\
**Post date:** [August 12, 2019, 11:05am UTC](https://discuss.elastic.co/t/how-to-change-a-number/194832/1 "2019-08-12T11:05:45Z")

</div>

hi, I'm using grok to pull out the user\_id field  
grok { match =\> { "authDN" =\> "uid=%{GREEDYDATA:user\_id}," } }  
My field user\_id=0212345678  
I always need to delete the first 0 and insert 421. HOW?

0212345678 -\> 421212345678

---

<div class="post-metadata">

**Author:** ![guyboertje](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/guyboertje/32/31592_2.png) [@guyboertje](https://discuss.elastic.co/u/guyboertje)\
**Post date:** [August 12, 2019, 11:37am UTC](https://discuss.elastic.co/t/how-to-change-a-number/194832/2 "2019-08-12T11:37:49Z")

</div>

You can you the `mutate` filter with the `gsub` function.

```auto
filter {
  mutate {
    gsub => ["[user_id]", "^0", "421" ]
  }
}

```

---

<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:** [September 9, 2019, 11:37am UTC](https://discuss.elastic.co/t/how-to-change-a-number/194832/3 "2019-09-09T11:37:52Z")

</div>

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