# Prefix a field in logstash based on size/length of field

**URL:** https://discuss.elastic.co/t/prefix-a-field-in-logstash-based-on-size-length-of-field/56664
**Category:** Logstash
**Created:** [July 28, 2016, 7:18pm UTC](https://discuss.elastic.co/t/prefix-a-field-in-logstash-based-on-size-length-of-field/56664 "2016-07-28T19:18:59Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![nkapur](https://avatars.discourse-cdn.com/v4/letter/n/848f3c/32.png) [@nkapur](https://discuss.elastic.co/u/nkapur)
#### Post date: [July 28, 2016, 7:18pm UTC](https://discuss.elastic.co/t/prefix-a-field-in-logstash-based-on-size-length-of-field/56664/1 "2016-07-28T19:18:59Z")

</div>

Hello! I have a field (string) called clubcode. Valid incoming values are say, 014, 14, 22, 022, 111. I want to replace 14 with 014 and 22 with 022 so that I can aggregate using clubcode as term in Kibana. How do I achieve this in logstash i.e. prefix clubcode with a 0 if the incoming size of clubcode data is 2 digits. Thanks!

---

<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: [July 6, 2017, 4:46am UTC](https://discuss.elastic.co/t/prefix-a-field-in-logstash-based-on-size-length-of-field/56664/2 "2017-07-06T04:46:05Z")

</div>


