# Can I add leading zeros to a field?

**URL:** <https://discuss.elastic.co/t/can-i-add-leading-zeros-to-a-field/122081>\
**Category:** Logstash\
**Created:** [March 1, 2018, 1:51pm UTC](https://discuss.elastic.co/t/can-i-add-leading-zeros-to-a-field/122081 "2018-03-01T13:51:58Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [March 1, 2018, 8:04pm UTC](https://discuss.elastic.co/t/can-i-add-leading-zeros-to-a-field/122081/2 "2018-03-01T20:04:59Z")

</div>

Do you always want to leading zeroes or do you always want the string to be five characters long? (Either way the answer would be to use a mutate filter's gsub option, but an exact answer depends on the details.)

---

_[View the full topic](https://discuss.elastic.co/t/can-i-add-leading-zeros-to-a-field/122081)._
