Templating an input plugin?

I have a question about best practice. Let's say I have two files as follows:

File 1. input.template.conf with the content

input {
  elasticsearch {
    ... several lines of configuration ...
  }
}

File 2. start-logstash.sh with the content:

# each of the items in the confs array is a file with filter{} and output{}.  It is only missing input{}
confs=("dmarc.conf" "sales-matchback.conf" "ga4-aggregation.conf" ... etc... )
for conf_file in "${confs[@]}"; do
  cat input.template.conf $conf_file > /etc/logstash/conf.d/$conf_file
done
# the next command will reference pipelines.yml and pipelines references all the configs in /etc/logstash/conf.d
/usr/share/logstash/bin/logstash 

Then to start logstash, i just run the command ./start-logstash.sh

Is it better to avoid the cat command and use something like Generating plugins | Logstash Reference [8.12] | Elastic ? Or is there something else I should consider all together?

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