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

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:

PartA: test
PartB: abc

Output Should be like:

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):

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

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