# Logstash Add Extra Space on a particular field based on the config

**URL:** <https://discuss.elastic.co/t/logstash-add-extra-space-on-a-particular-field-based-on-the-config/245520>\
**Category:** Logstash\
**Created:** [August 19, 2020, 4:29am UTC](https://discuss.elastic.co/t/logstash-add-extra-space-on-a-particular-field-based-on-the-config/245520 "2020-08-19T04:29:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mastersmit](https://avatars.discourse-cdn.com/v4/letter/m/f475e1/32.png) [@mastersmit](https://discuss.elastic.co/u/mastersmit)\
**Post date:** [August 19, 2020, 4:29am UTC](https://discuss.elastic.co/t/logstash-add-extra-space-on-a-particular-field-based-on-the-config/245520/1 "2020-08-19T04:29:01Z")

</div>

I have a particular requirement where I have extracted out a field based on the GROK patterns. And based on the length of the attribute, i have to add `space` at the end of the string.

For example:

Attribute:

```auto
PartA: test
PartB: abc

```

Output Should be like:

```auto
test#####abc##          

```

Where the requirement says `partA` should be of length `10` and `partB` should be of length `5`. So if you see, I have added extra space (`#`) based on the current length of the attribute.

I am currently trying to create a new line based on the output above requirement,

here is the attempt (logstash.conf):

```auto
file {
   path => "/Users/Smit/Downloads/chrome/observability/logstash_dump.txt"
   codec => line { format => "%{PartA}#####${PartB}###"}
  }
 }

```

Is there a way to dynamically append space (`#` used this for clarity) instead of hardcoding.

Here is the full logstash file: [https://dpaste.org/dsuH](https://dpaste.org/dsuH)

---

<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 16, 2020, 4:29am UTC](https://discuss.elastic.co/t/logstash-add-extra-space-on-a-particular-field-based-on-the-config/245520/2 "2020-09-16T04:29:25Z")

</div>

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